0

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.

2 Answers 2

5

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

Sign up to request clarification or add additional context in comments.

Comments

0

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 ,

1 Comment

Wrong: you won't modify the default push "path", you'll just compress these commands: git remote rm origin and git remote add myapp <URI>, so it's like you'll delete the remote 'origin' and create 'myapp'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.