Git - git remote
In Git
, 开发者_如何学编程if we have the following command:
$ git remote add myapp git@github.com:xyz/myapp.git
What does this command mean? And, does it differ if we replace myapp
with origin
?
Thanks.
Git remote means you link a git URI to a name, to a label.
If git@github.com:xyz/myapp.git
is the URI you'll want to push to, then if you write
git remote add myapp git@github.com:xyz/myapp.git
instead of
git remote add origin git@github.com:xyz/myapp.git
you'll have to modify the push command too, like this:
git push myapp
This is not always true, you can set up a remote for some other repo because you want to have fast access to it.
For example if you'll get a lot of pull request from the same user/repo you will want to add a remote for that repo so you can inspect changes made to it(the repo linked by the remote).
Please read:
http://progit.org/book/ch2-5.html -> if you read this you'll understand git remotes completely
http://www.kernel.org/pub/software/scm/git/docs/git-remote.html
Well the above command essentially is to tell git where the remote repository you intend to check on .
If you peek into the config file under .git you will see something like ::
[remote "origin"]
url = git@github.com:xxx/xxx.git
That would be [remote "myapp"] in your case .
EDITED ::
You won't modify the default push "path", you'll just compress these commands: git remote rm origin and git remote add myapp ,
精彩评论