git push
takes two additional arguments:
- the name of a remote, such as
origin
- the name of a branch, such as
master
or login
That is, you want:
git push origin login
It's important to keep these two concepts separate: a remote like origin
is a short name that you and Git use to keep track of a longer name like https://github.com/some/repo.git
or ssh://git@github.com/some/repo.git
, which is completely different from a branch name.
What makes this confusing is that besides these concepts and terms—remote and branch—there is a third concept, described by a another sequence of words, usually written as remote-tracking branch.1 This third concept involves strings of the form origin/master
and origin/login
. It can become very confusing as to when you should write origin login
and when you should write origin/login
.
The trick would be to consult the documentation, and keep close track of whether it says remote or branch. Unfortunately, the documentation uses neither of those terms, because those are actually special cases of even-more general form. So the documentation (now, Git 2.192) says:
git push
[--all
| --mirror
| --tags
] [--follow-tags
] [--atomic
] [-n
| --dry-run
] [--receive-pack=<git-receive-pack>
]
[--repo=<repository>
] [-f
| --force
] [-d
| --delete
] [--prune
] [-v
| --verbose
]
[-u
| --set-upstream
] [-o <string>
| --push-option=<string>
]
[--
[no-
]signed
|--signed=
(true
|false
|if-asked
)]
[--force-with-lease
[=<refname>
[:<expect>
]]]
[--no-verify
] [<repository>
[<refspec>...
]]
and the two arguments I am talking about here are called the repository and the refspec, rather than the remote and the branch. How one is supposed to get through all of that, as a beginner, is not at all clear.
(This is a long-winded way of saying that the Git documentation is not so great.)
1I prefer the term remote-tracking name now, because while it has some of the aspects of a branch name, it also has some that are different. Either way, though, this third concept takes the form shown above.
2Older versions of git push
have fewer optional arguments.