Remote Repository
My commits only exist on my computer. How can others see them?
When to use it
- Check the linked remote addresses$ git remote -vorigin https://github.com/you/my-first-page.git (fetch)
- Name the default remote origin$ git remote add origin https://github.com/you/my-first-page.gitCloning usually sets up origin automatically
- After a rejected push, review remote commits, pull to integrate them, then decide whether to pushgit pull→git push→Push succeeded ✓
- Clone copies the remote’s current commits and commonly names that remote origin$ git clone https://github.com/you/my-first-page.gitCloning into 'my-first-page'...
When NOT to use it
- Commit secrets or .env files and push them.env holds keys; after pushing anyone can read themNever commit keys or passwords to a repository
- Force push over remote history after a rejectiongit push --force erased the 3 commits a teammate just pushedWhen rejected, pull and merge instead of force pushing
- Push to the wrong remote addressPushed to someone else's repository addressConfirm the address with git remote -v before pushing
- Assume pushing means the site is deployedgit push ✓→The site did not update
A commit first exists in the local repository. The remote branch moves only after a successful push.
| Local repository | Has B |
| Remote main (origin) | Has B |
A remote commit is available to others; deployment still depends on a separate deployment process.
| A | Local + remote |
| B | Local + remote |
| C · teammate's fix | Remote; not local yet |
The remote has C, which your local branch lacks. Git rejects a direct push to protect the other commit; inspect and integrate C first.
Review C, then integrate according to the project's pull configuration. Keeping the teammate's commit brings both histories back in sync.