When executing a build for git repository giantswarm/docs-content
in CircleCI, I'd like to push a commit to another repository giantswarm/docs
.
I have this in the deployment
section of circle.yml
:
git config credential.helper cache
git config user.email "<some verified email>"
git config user.name "Github Bot"
git clone --depth 1 https://${GITHUB_PERSONAL_TOKEN}:[email protected]/giantswarm/docs.git
cd docs/
git commit --allow-empty -m "Trigger build and publishing via docs-content"
git push -u origin master
This fails in the very last command with this error message:
ERROR: The key you are authenticating with has been marked as read only.
fatal: Could not read from remote repository.
The GITHUB_PERSONAL_TOKEN
environment variable is set to a user's personal access token, which has been created with repo
scope to access the private repo giantswarm/docs
. In addition, I added the user to a team that has admin permissions for that repo.
That series of commands works just fine when I execute it in a fresh Ubuntu VM. Any idea why it doesn't on CircleCI?
To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.
I've used
git push -q https://${GITHUB_PERSONAL_TOKEN}@github.com/<user>/<repo>.git master
and it worked. Update it to be:
# Push changes
git config credential.helper 'cache --timeout=120'
git config user.email "<email>"
git config user.name "<user-name>"
git add .
git commit -m "Update via CircleCI"
# Push quietly to prevent showing the token in log
git push -q https://${GITHUB_PERSONAL_TOKEN}@github.com/giantswarm/docs.git master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With