Git 为什么可以';我不能推动我的新分支吗?
我创建了一个新分支,签出并提交:Git 为什么可以';我不能推动我的新分支吗?,git,github,git-branch,Git,Github,Git Branch,我创建了一个新分支,签出并提交: git branch my-branch [HASH] git checkout my-branch git commit -am "Add some stuff to my new branch" 但是,我无法将其推送到githubgit推送原点我的分支返回: error: src refspec branch does not match any. error: failed to push some refs to 'https://github.com
git branch my-branch [HASH]
git checkout my-branch
git commit -am "Add some stuff to my new branch"
但是,我无法将其推送到github<代码>git推送原点我的分支返回:
error: src refspec branch does not match any.
error: failed to push some refs to 'https://github.com/Me/my-project.git'
git show refs
如下所示:
[HASH] refs/heads/my-branch
[HASH] refs/heads/master
[HASH] refs/heads/some-branch
[HASH] refs/remotes/origin/master
[HASH] refs/remotes/origin/some-branch
[HASH] refs/stash
我需要做什么?命令行解析中出现错误。正如您在此消息中所看到的:
error: src refspec branch does not match any.
git尝试推送名为branch
的分支,而不是mybranch
。您正在运行什么操作系统/shell?也许试试
git push origin "my-branch"
该分支在github上不存在,当推送git时,会检查分支的原始引用,但找不到它 将分支添加为远程分支: git 1.8.x
git branch -u origin/my-branch my-branch
git branch --set-upstream my-branch origin/my-branch
git 1.7.x
git branch -u origin/my-branch my-branch
git branch --set-upstream my-branch origin/my-branch
现在您可以推送了。下面是将所有更改从本地分支(“我的分支”)推送到GitHub存储库上的“我的分支”分支的命令:
git push -u origin my-branch
尝试推送-u来源我的分支?@fatfredyy相同的错误消息?