gpt4 book ai didi

git - "git push"到github时报错

转载 作者:IT王子 更新时间:2023-10-29 01:14:24 24 4
gpt4 key购买 nike

我在 github.com 有一个公共(public)存储库,有 2 个分支:mastertest

我在本地创建了一个新目录并做了:

[ ] git clone git@github.com:{username}/{projectname}.git

然后我创建了一个名为 my_test 的新分支

[ ] git branch my_test

然后切换到它。

[ ] git checkout my_test

然后我将它从我的公共(public)存储库的 test 分支与

merge
[ ] git merge origin/test

这导致了快进。

我做了一些更改并提交了它们。然后我尝试使用

将本地 my_test 分支推送到 github 上的公共(public) test 分支
[ ] git push git@github.com:{username}/{projectname}.git test 

但是我得到了这个错误:

error: src refspec test does not match any.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'git@github.com:{username}/{projectname}.git

我做错了什么?

最佳答案

也许试试:

git push git@github.com:{username}/{projectname}.git HEAD:test

该命令行上最后一个参数的格式是 refspec,即源引用后跟冒号,然后是目标引用。您还可以使用本地分支名称 (my_test) 而不是 HEAD 来确定您推送的是正确的分支。

git push 的文档有关于此参数的更多详细信息。

关于git - "git push"到github时报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/959477/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com