Git push/clone to new server Ask Question

Git push/clone to new server Ask 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.

ベストアンサー1

  1. git remote add name url
  2. git push name branch

Example:

git remote add origin [email protected]: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).

おすすめ記事