Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.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
Ios 我能';t在fastlane中使用push_to_git_remote()_Ios_Xcode_Gitlab_Gitlab Ci_Fastlane - Fatal编程技术网

Ios 我能';t在fastlane中使用push_to_git_remote()

Ios 我能';t在fastlane中使用push_to_git_remote(),ios,xcode,gitlab,gitlab-ci,fastlane,Ios,Xcode,Gitlab,Gitlab Ci,Fastlane,我对gitlab、gitlab ci和fastlane有意见。在fastlane中,我使用: def increment_build_and_commit incrementBuildNumber() commit_version_bump(message: 'build number bump [skip ci]') push_to_git_remote( remote: 'origin_rw', remote_branch: ENV['CI_COM

我对gitlab、gitlab ci和fastlane有意见。在fastlane中,我使用:

  def increment_build_and_commit
    incrementBuildNumber()
    commit_version_bump(message: 'build number bump [skip ci]')
    push_to_git_remote(
    remote: 'origin_rw',
    remote_branch: ENV['CI_COMMIT_BRANCH']
    )   
  end
所以我想增加构建数量并提交。因此,这项工作需要:

incrementBuildNumber(),
commit_version_bump(message: 'build number bump [skip ci]')
但在运行时,它在push_to_git_remote时失败

[!]命令“git push origin”的退出状态\u rw HEAD:HEAD--标记 --“设置上游”为1而不是0。错误:您提供的目标不是完整的ref名称(即,以“refs/”开头)。我们 试图猜出你的意思:

  • 正在查找与远端“HEAD”匹配的ref
  • 检查被推送的('HEAD')是否是“refs/{heads,tags}/”中的ref。如果是这样,我们将添加相应的
    远程端的refs/{heads,tags}/前缀。两个都没用,所以我们 放弃了。您必须完全限定ref。提示:部分 refspec是一个提交对象。提示:您的意思是创建一个新分支吗 按下提示:“头部:参考/头部/头部”?错误:推送失败 对“************.git”的一些引用
你们中的一些人知道该做什么以及如何解决这个问题吗?因为我将成为谷歌的机器,但不幸的是,我找不到解决方案。
提前感谢

之所以会发生这种情况,是因为gitlab ci签出git commit而不是git branch,并且您进入了分离头状态

有几种方法可以解决这个问题:

1) 使用CI提供的值。对于GitLab,我建议使用
CI\u PIPELINE\u IID
。缺点是您无法控制它,如果您将项目迁移到其他存储库,它将再次从1开始

2) 在提交之前签出git分支。缺点是,如果其他开发人员推到同一分支,您的管道将继续使用错误的源代码

3) 手动提交版本号。