Erik Fredericks, frederer@gvsu.edu Fall 2025
Based on material provided by Erin Carrier, Austin Ferguson, and Katherine Bowers
But what about remote? Off your computer? Somewhere else?
Meaning, somebody is running a git server somewhere
Let's say you have a local repo and want to tie it to a remote server:
git remote add origin remote_url
git push --set-upstream origin main
Go to your server (i.e., GitHub) and create a new repo with your favorite license and a README file
git clone remote_url
Then, your usual workflow (edit, add, commit, push)
push
Update the remote with your commit!
git push
However, since we're remote, check if anybody else made changes!!
git fetch
git merge
When working with remotes, the easiest way to avoid merge conflicts are to always pull before you make a change
pull
git pull
fetch
merge
That's the topic of the next slide deck, however one easy way to deal:
rebase
Commit from a detached head (checkout a previous commit then make a commit)
Reset to a commit
Ammend a commit once it's been pushed
DO NOT REWRITE HISTORY IN ANY WAY
Also, push a secrets/password/API key file to GitHub without anonymizing it
Changes in past years means that you cannot use a username/password to update your remote on the terminal!
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
git remote remove origin
fetch updates repo but doesn't merge changes!
rebase rewrites history (merges branch history)