Why does git push sometimes require the localref argument?

I ran into a problem with git push today. I tried pushing a branch to the remote repository, but it gave an error.

After some searching, I asked him on the git irc channel, and someone said that the click syntax was

git push <remote> <localref>:<remoteref>

So far, I just used git push, which worked fine. But in this case, he failed.

I tried to push another branch, other than the master one, to the remote server, and I received the following error:

error: src refspec xi-temp-dennis does not match any.
error: failed to push some refs to 'remote.server'

By setting a local parameter, it unexpectedly works.

My question is why do I need to specify localref this time?

+3
source share
1 answer

"git push remote" , - push, Git " ". " " - , . .

, "" , "" , "git push remote" .

"xi-temp-dennis", . Git (, " -" ).

Git, ref , :

git push remote xi-temp-dennis:foo

"foo", . , ( xi-temp-dennis: foo), . "git push remote" , , :

git push remote xi-temp-dennis:xi-temp-dennis
+4

Source: https://habr.com/ru/post/1709709/


All Articles