2

我也一直在使用带有远程仓库的 git 分支(Bit bucket)

我决定创建一个新分支,所以运行了这段代码

Directory= ~/tmp/merge/aaa> git branch iOSUI/beta
Directory= ~/tmp/merge/aaa> git checkout iOSUI/beta
Switched to branch 'iOSUI/beta'

然后试着推

Directory= ~/tmp/merge/aaa> git push origin iOS7UI/beta
error: src refspec iOS7UI/beta does not match any.
error: failed to push some refs to 'https://xxx/repo.git'

所以我尝试创建一个远程分支

Directory= ~/tmp/merge/aaa> git branch origin iOSUI/beta
error: there are still refs under 'refs/heads/origin'
fatal: Failed to lock ref for update: Is a directory

失败后,我通过选择 push 尝试了 XCode,然后它成功推送到

'起源/iOS7UI/测试版'

我再次尝试了命令行 2 选项

Directory= ~/tmp/merge/aaa> git push origin iOS7UI/beta
error: src refspec iOS7UI/beta does not match any.
error: failed to push some refs to 'https://xxx/repo.git'

and this option with the '/'

Directory= ~/tmp/merge/pixtr> git push origin/iOS7UI/beta
fatal: 'origin/iOS7UI/beta' does not appear to be a git repository
fatal: Could not read from remote repository.
4

1 回答 1

1

最近的默认推送策略“ simple会阻止您推送到不存在的分支(除非它被设置为您的上游分支)。

你需要做:

git push -u origin iOS7UI/beta

但首先检查您创建的分支是否已推送或与上游 repoiOS7UI/beta相比是最新的。 如果它落后,这意味着基于尚未推送到原点的父 SHA1。
iOS7UI/beta

于 2013-09-16T10:40:29.717 回答