Question:
I’m just learning Git and there is something I can’t work out. After creating and using a git repository locally on my Mac, can I push a copy to another server somewhere else? I am behind a firewall so unfortunately I can’t run git clone
from the other machine.
Answer:
git remote add
name urlgit push
name branch
Example:
1 2 3 |
git remote add origin git@github.com:foo/bar.git git push origin master |
See the docs for git push
— you can set a remote as the default remote for a given branch; if you don’t, the name origin
is special. Just git push
alone will do the same as git push origin
thisbranch (for whatever branch you’re on).