【问题标题】:Travis CI push build to new repositoryTravis CI 将构建推送到新存储库
【发布时间】:2016-01-18 21:06:18
【问题描述】:

我正在尝试在 after_success 期间将 travis CI 项目的构建版本推送到不同的存储库

以下脚本在构建完成后由 travis 运行:

git config user.name "Travis CI"
git config user.email "fake@fake.com"
git config --global push.default simple
git add . -f #force adding to include files in .gitignore
git commit -m "built with love by travis <3"
git remote add production https://${GH_TOKEN}:x-oauth-basic@github.com/my_username/repo.git
git push production master --force #ensure repo is in correct state

GH_TOKEN 是存储在 .travis.yml 中的加密 github 令牌显然,我已经编辑了一些私人信息。

当这个脚本由 travis 运行时,我收到以下错误:

remote: fatal: did not receive expected object [redacted]
error: unpack failed: index-pack abnormal exit
To https://[redacted token]:x-oauth-basic@github.com/my_username/repo.git
 ! [remote rejected] HEAD -> master (failed)
error: failed to push some refs to 'https://[redacted token]:x-oauth-basic@github.com/my_username/repo.git'

这是我的脚本、travis 或 github 的问题吗?

【问题讨论】:

  • 您的 OAuth 令牌是否具有正确的权限?尝试在其配置中勾选更多框。

标签: git github travis-ci


【解决方案1】:

我不确定问题出在哪里,但我修改了脚本以在 travis 中初始化一个新的空 git 存储库,一切顺利:

rm -rf .git/
git init
git config user.name "Travis CI"
git config user.email "travis@domain.com"
git config --global push.default simple
git add .
git commit -m "built with love by travis <3"
git remote add production https://${GH_TOKEN}@github.com/user/repo.git
git push production master --force

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-12
    • 2019-09-25
    • 1970-01-01
    • 2021-06-19
    相关资源
    最近更新 更多