How to push a commit to Github from a CircleCI build using a personal access token

后端 未结 3 1440
旧巷少年郎
旧巷少年郎 2021-02-07 09:32

When executing a build for git repository giantswarm/docs-content in CircleCI, I\'d like to push a commit to another repository giantswarm/docs.

<
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-07 10:13

    I've used

    git push -q https://${GITHUB_PERSONAL_TOKEN}@github.com//.git master
    

    and it worked. Update it to be:

    # Push changes
    git config credential.helper 'cache --timeout=120'
    git config user.email ""
    git config 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
    

提交回复
热议问题