Simplicity
Simplicity

Reputation: 48916

Git - git remote

In Git, if we have the following command:

$ git remote add myapp [email protected]:xyz/myapp.git

What does this command mean? And, does it differ if we replace myapp with origin?

Thanks.

Upvotes: 0

Views: 279

Answers (2)

Anil Shanbhag
Anil Shanbhag

Reputation: 968

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 = [email protected]: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 ,

Upvotes: 0

Paul
Paul

Reputation: 21975

Git remote means you link a git URI to a name, to a label.

If [email protected]:xyz/myapp.git is the URI you'll want to push to, then if you write

git remote add myapp [email protected]:xyz/myapp.git

instead of

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

Upvotes: 5

Related Questions