git - 无法从 bitbucket 管道 yml 脚本中签出 git 分支
问题描述
在部署到我的 QA 服务器之前,我希望在 staging 之上进行 rebase(或与 staging 合并),这样它将包含来自我的分支的最新更改 + 更改。
作为第一步,我尝试签出暂存并失败:我在 bitbucket-pipelines.yml 中有以下配置
merge:
- step:
name: merge with staging
image: node:8
script:
- git remote update
- git fetch origin
- git branch -f staging origin/staging
- git checkout staging
错误:
+ git branch -f staging origin/staging
fatal: Not a valid object name: 'origin/staging'.
我确实尝试了许多在本地工作的其他变体,但一切都失败了……看起来 bitbucket 限制了对其他分支的访问……
检查 bitbucket 管道中的分支的正确方法是什么?
解决方案
在 fetch 命令之前,您需要使用以下命令对其进行配置:
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
推荐阅读
- azure-devops - 如何在 Azure DevOps 的 Script.PostDeployment.sql 中引用 sql 脚本(不是过程)?
- php - 如何在 Laravel/Eloquent 中使用字符串字段的一部分搜索记录?
- string - 在 MSVC 中将字母的字符代码转换为包含字母本身的字符串
- jquery - Elasticsearch 更改响应格式
- gradle - Gradle 中是否有一种方法可以定义应该(或不应该)通过存储库解决哪些工件模式?
- c++ - 如何实现对向量的元素顺序添加,在插入之前对其进行排序?
- jquery - jQuery Firing on.Change 每次更改的事件
- webvr - 我尝试制作 webvr 全景图,但我的图像似乎是错误的
- discord.js - 我不能为我的机器人使用公会(我刚开始使用 discord.js)
- vue.js - 使用 vue 的开发服务器忽略新文件