【问题标题】:How to push to new git branch not with Xcode如何不使用 Xcode 推送到新的 git 分支
【发布时间】:2013-09-16 21:49:30
【问题描述】:

我也一直在使用带有远程仓库的 git 分支(比特桶)

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

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/beta'

我再次尝试了命令行 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.

【问题讨论】:

    标签: xcode git


    【解决方案1】:

    recent default push policy "simple" 会阻止您推送到不存在的分支(除非它设置为您的 upstream branch)。

    你需要这样做:

    git push -u origin iOS7UI/beta
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-01
      • 2018-01-27
      • 1970-01-01
      • 2022-01-23
      • 2010-11-07
      • 2011-05-02
      • 2017-12-18
      • 2019-02-13
      相关资源
      最近更新 更多