Daniel
Daniel

Reputation: 6039

What would happen if we do `git push master` when having multiple remotes?

What is the effect of git push master if I have multiple remotes? Is it going to be equivalent to git push origin master?

Upvotes: 0

Views: 26

Answers (2)

Felix Kling
Felix Kling

Reputation: 816810

You will get an error because you likely don't have a repository with name "master". If you only pass a single argument, it is interpreted as the name of the remote repository, not the branch.

This is also evident from the man page:

git push ... [<repository> [<refspec>...]]

Upvotes: 2

choroba
choroba

Reputation: 241998

Use git push only. If you set the upstream reference, it'll be pushed. Use git push -u to set the upstream reference.

Upvotes: 1

Related Questions