使用Github操作使用访问令牌推送到Gitlab
首先,我对Github操作还很陌生 我尝试使用Github操作自动将我的repo推送到带有访问令牌的Gitlab。但是,我总是收到错误使用Github操作使用访问令牌推送到Gitlab,git,gitlab,github-actions,Git,Gitlab,Github Actions,首先,我对Github操作还很陌生 我尝试使用Github操作自动将我的repo推送到带有访问令牌的Gitlab。但是,我总是收到错误remote:HTTP基本:拒绝访问致命:身份验证失败'https://gitlab.com/chuang_/jskara-web.git/“ 我在,git config--system--unset credential.helper中尝试了该解决方案,但如果我将该行放入.yml,它将中断并返回错误代码5。如果我不把这一行,我会得到上面描述的错误 具有已尝试历史
remote:HTTP基本:拒绝访问致命:身份验证失败'https://gitlab.com/chuang_/jskara-web.git/“
我在,git config--system--unset credential.helper中尝试了该解决方案,但如果我将该行放入.yml,它将中断并返回错误代码5。如果我不把这一行,我会得到上面描述的错误
具有已尝试历史记录的My.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
尝试将带有令牌的env
块移动到“推送到Gitlab”步骤。当前您将远程url设置为https://oauth2:@gitlab.com/chuang_/jskara web.git
astoken
变量从未设置。谢谢,它成功了。我误解了环境变量的含义。