Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 将远程/源/分支推送到远程_Git_Github_Git Push - Fatal编程技术网

Git 将远程/源/分支推送到远程

Git 将远程/源/分支推送到远程,git,github,git-push,Git,Github,Git Push,因此,我在一台机器上创建了一个分支“幻灯片安全修复程序”将其推到远程,然后切换到另一台机器,克隆创建的分支并进行了一些更改,但我的本地机器上的这个分支现在称为remotes/origin/slide security fix。因此,我尝试使用应用的更改将此分支推回远程: git push origin remotes/origin/slide-security-fix 但它给了我一个错误: error: src refspec remotes/origin/slide-security-fix

因此,我在一台机器上创建了一个分支“幻灯片安全修复程序”将其推到远程,然后切换到另一台机器,克隆创建的分支并进行了一些更改,但我的本地机器上的这个分支现在称为remotes/origin/slide security fix。因此,我尝试使用应用的更改将此分支推回远程:

git push origin remotes/origin/slide-security-fix
但它给了我一个错误:

error: src refspec remotes/origin/slide-security-fix matches more than one.
error: failed to push some refs to 'myrepo.git'
我一直在寻找解决方案,唯一能找到的就是明确指定我的远程分支:

git push origin remotes/origin/slide-security-fix:remotes/origin/slide-security-fix

但它仍然不起作用

一个简单的解决方案是

git push origin HEAD:slide-security-fix
它将告诉git将当前签出的提交推送到远程服务器名为
slide security fix
的分支上

你也可以给你正在工作的分支机构起一个适当的名字。例如,你可以这样做

#Create a local branch on the current commit. Call it slide-security-fix. And check it out
git checkout -b slide-security-fix

#Then push
git push origin slide-security-fix