我想
在部署到我的 QA 服务器之前,在暂存(或与暂存合并(之上变基,以便它包含来自我的分支的最新更改 + 更改。
作为第一步,我尝试签出暂存并失败了:我在 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限制了对其他分支的访问。
签出位桶管道中的分支的正确方法是什么?
在 fetch 命令之前,您需要使用以下内容对其进行配置:
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
以下内容
似乎是我问题的解决方案,因为我可以避免签出暂存:
name: Build and test on QA env
image: node:8
script:
- git fetch origin
- git pull --rebase origin staging --verbose
- npm ci
- npm test
- npm run build
另一方面,它没有回答提出的问题,所以我暂时保持这个"开放">