从私人仓库推送到 public 仓库失败,状态码为 403
Pushing to public repo from private repo failed with status code 403
我有 2 个存储库:user/ext-private 和 user/ext-public。我想将一些文件推送到 public 存储库,但它失败并出现以下错误:
[master 869955c] update it
1 file changed, 1 insertion(+), 1 deletion(-)
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
remote: Permission to user/ext-public.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/user/ext-public/': The requested URL returned error: 403
Error: Process completed with exit code 128.
这是我的操作:
name: Master Branch
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
cache: 'yarn'
- run: yarn
- name: Checkout Public repo
uses: actions/checkout@v2
with:
repository: user/ext-public
path: ext-public
ref: 'master'
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Update file
run: |
git config -l
echo "Hello you!" >> README.md
git config --global user.name 'GithubUser'
git config --global user.email 'MYActions@users.noreply.github.com'
git add .
git commit -m "update it"
git status
git push -u origin HEAD
working-directory: ext-public
在此处查看错误日志
https://github.com/coure2011/ext_code/runs/5548688844?check_suite_focus=true
问题是您使用的是 GITHUB_TOKEN(它有一个 specific permission scope) instead of a PAT (Personal Access Token)。
您不能使用 GITHUB_TOKEN 推送到另一个仓库,您需要 PAT 才能这样做。
还有很多actions from the marketplace给你做push操作,添加PAT为密文后
我有 2 个存储库:user/ext-private 和 user/ext-public。我想将一些文件推送到 public 存储库,但它失败并出现以下错误:
[master 869955c] update it
1 file changed, 1 insertion(+), 1 deletion(-)
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
remote: Permission to user/ext-public.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/user/ext-public/': The requested URL returned error: 403
Error: Process completed with exit code 128.
这是我的操作:
name: Master Branch
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
cache: 'yarn'
- run: yarn
- name: Checkout Public repo
uses: actions/checkout@v2
with:
repository: user/ext-public
path: ext-public
ref: 'master'
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Update file
run: |
git config -l
echo "Hello you!" >> README.md
git config --global user.name 'GithubUser'
git config --global user.email 'MYActions@users.noreply.github.com'
git add .
git commit -m "update it"
git status
git push -u origin HEAD
working-directory: ext-public
在此处查看错误日志 https://github.com/coure2011/ext_code/runs/5548688844?check_suite_focus=true
问题是您使用的是 GITHUB_TOKEN(它有一个 specific permission scope) instead of a PAT (Personal Access Token)。
您不能使用 GITHUB_TOKEN 推送到另一个仓库,您需要 PAT 才能这样做。
还有很多actions from the marketplace给你做push操作,添加PAT为密文后