I am attempting to push the built version of a travis CI project to a different repository during after_success
The following script is run by travis once the build has completed:
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 is an encrypted github token stored in .travis.yml Obviously, I have redacted some private information.
When this script is run by travis, I am receiving the following error:
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'
Is this a problem with my script, travis, or github?
I'm not exactly sure what the issue was, but I modified my script to initialize a new empty git repository within travis and everything worked smoothly:
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.