JamesIves/github-pages-deploy-action

fatal: Authentication failed

3000ye opened this issue · 1 comments

Describe the bug

I add an action to repo: codeBlog, and want to deploy file to repo: codeBlogPage.

I know maybe have to add a token, but I do not know how to add.

# Simple workflow for deploying static content to GitHub Pages
name: Push Pages

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["main"]

jobs:
    build:
        runs-on: ubuntu-latest
        permissions:
            # Give the default GITHUB_TOKEN write permission to commit and push the
            # added or changed files to the repository.
            contents: write
        steps:
          - uses: actions/checkout@v3
    
          - name: Cache Hugo resources
            uses: actions/cache@v3
            env:
                cache-name: cache-hugo-resources
            with:
                path: resources
                key: ${{ env.cache-name }}
    
          - uses: actions/setup-go@v4
            with:
                go-version: "^1.17.0"
          - run: go version
    
          - name: Setup Hugo
            uses: peaceiris/actions-hugo@v2
            with:
                hugo-version: "latest"
                extended: true
    
          - name: Build
            run: hugo
            
          - name: Deploy to GitHub Pages
            uses: JamesIves/github-pages-deploy-action@v4.5.0
            with:
              branch: main
              folder: public
              commit-message: update pages
              clean: true
              git-config-name: "3000ye"
              git-config-email: "hcg2924239214@163.com"
              repository-name: 3000ye/codeBlogPage
              single-commit: true

Logs

Checking configuration and starting deployment… 🚦
Deploying using Deploy Token… 🔑
Configuring git…
/usr/bin/git config --global --add safe.directory /home/runner/work/codeBlog/codeBlog
/usr/bin/git config user.name 3000ye
/usr/bin/git config user.email hcg29242[39](https://github.com/3000ye/codeBlog/actions/runs/8036211054/job/21949645784#step:8:40)214@163.com
/usr/bin/git config core.ignorecase false
/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
/usr/bin/git remote rm origin
/usr/bin/git remote add origin ***github.com/3000ye/codeBlogPage.git
Git configured… 🔧
Starting to commit changes…
/usr/bin/git ls-remote --heads ***github.com/3000ye/codeBlogPage.git refs/heads/main
ed3e3cf[40](https://github.com/3000ye/codeBlog/actions/runs/8036211054/job/21949645784#step:8:41)dd9f913cbdf2e1b8013ec2c71eba199	refs/heads/main
Creating worktree…
/usr/bin/git fetch --no-recurse-submodules --depth=1 origin main
From https://github.com/3000ye/codeBlogPage
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main
/usr/bin/git worktree add --no-checkout --detach github-pages-deploy-action-temp-deployment-folder
Preparing worktree (detached HEAD 13a635f)
/usr/bin/git checkout -B main origin/main
Previous HEAD position was 13a635f add token
Switched to and reset branch 'main'
branch 'main' set up to track 'origin/main'.
/usr/bin/chmod -R +rw /home/runner/work/codeBlog/codeBlog/public
/usr/bin/rsync -q -av --checksum --progress /home/runner/work/codeBlog/codeBlog/public/. github-pages-deploy-action-temp-deployment-folder --delete --exclude CNAME --exclude .nojekyll --exclude .ssh --exclude .git --exclude .github
/usr/bin/git add --all .
Checking if there are files to commit…
/usr/bin/git add --all .
/usr/bin/git checkout -b github-pages-deploy-action/nyat[66](https://github.com/3000ye/codeBlog/actions/runs/8036211054/job/21949645784#step:8:67)aks
Switched to a new branch 'github-pages-deploy-action/nyat66aks'
/usr/bin/git commit -m update pages --quiet --no-verify
Force-pushing changes...
/usr/bin/git push --force ***github.com/3000ye/codeBlogPage.git github-pages-deploy-action/nyat66aks:main
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/3000ye/codeBlogPage.git/'
Running post deployment cleanup jobs… 🗑️
/usr/bin/git checkout -B github-pages-deploy-action/nyat66aks
Reset branch 'github-pages-deploy-action/nyat66aks'
/usr/bin/chmod -R +rw github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Error: The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 128 ❌
Notice: Deployment failed! ❌

I change to use ssh-key, and it success!