【发布时间】:2020-11-28 05:03:38
【问题描述】:
首先,我对 Github Actions 很陌生。
我试图使用 Github Actions 自动将我的 repo 推送到带有访问令牌的 Gitlab。但是,我总是收到错误remote: HTTP Basic: Access denied fatal: Authentication failed for 'https://gitlab.com/chuang_/jskara-web.git/'
我尝试了GitLab remote: HTTP Basic: Access denied and fatal Authentication、git config --system --unset credential.helper 中的解决方案,但是如果我将该行放入 .yml 中,它将中断并返回错误代码 5。如果我不放入该行,我将收到错误如上所述。
我的 .yml 文件有尝试过的历史记录:https://github.com/ChuangSheep/javascript-kara-web/blob/master/.github/workflows/pushToGitlab.yml
这是我最近的尝试
name: PushGitlab
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
env:
token: ${{ secrets.GITLAB_ACCESS_TOKEN }}
- name: Push To Gitlab
run: |
echo Starting to push repo to gitlab
git config user.name "ChuangSheep"
git config user.email "44814054+ChuangSheep@users.noreply.github.com"
git remote set-url origin "https://oauth2:${token}@gitlab.com/chuang_/jskara-web.git"
git push origin master
【问题讨论】:
标签: git gitlab github-actions