github - git 提交到远程分支的诡异错误
伊谢尔伦
伊谢尔伦 2017-04-22 08:59:39
0
2
698

我想把我的本地分支push到github上的远程分支上,假设我的本地分知名是A,远程分支名也是A, 我刚开始输入如下命令:

git push origin A : A

结果报错:

error: dst ref refs/heads/A receives from more than one src. error: failed to push some refs to 'git@github.com:ningyu/algos.git'

google不到答案,我就尝试着把命令中冒号两边的空格去掉,因为有文章用的命令是没有空格的。

git push origin A:A

结果竟然提交成功。我提交后又试了一下有空格的命令,还是同样的错误。

请问大家这个是怎么回事,是真的由空格导致的吗?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
巴扎黑

For users, it is a problem caused by spaces. There are many problems caused by spaces in the shell, such as this tragedy caused by a space.

For git, your parameters are wrong. It clearly requires three parameters "push", "origin" and "A:A", but you gave it five: "push", "origin", "A", ":" and "A".

PS: git push origin A:A 可简写为 git push orgin A.

Peter_Zhu

Please don’t step on me, I’m afraid what I said is difficult to understand.

When I was reading "Mastering Regular Expressions", I read a statement that we might treat the space character as a shell metacharacter (not to mention a delimiter), but the role of the space character is to Split characters are used to split command line parameters. For example, we don’t need to use args.split('s')的方法来分割命令参数,直接取

... when writing shell programs.

A:AOn this issue, I think

should be a complete part. 🎜
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template