如何解决Github Action致命错误 - 没有这样的设备或地址

问题描述 投票:0回答:1

我在运行 github 操作以将更新部署到 AWS EC2 时遇到致命错误。 github 操作一直运行,没有错误,直到 PAT 过期,我生成了一个新操作并更新了存储库的秘密

ACCESS_TOKEN

这是致命错误

错误:致命:无法读取“https://***@github.com”的密码:没有这样的设备或地址

Github 行动

name: UAT Integration

run-name: Code integration by @${{ github.actor }}
on:
  push:
    branches:
      - uat

jobs:
  integration-test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Configure PHP 8.1
        uses: shivammathur/setup-php@master
        with:
          php-version: 8.1

      - name: Copy .env
        run: php -r "file_exists('.env') || copy('.env.example', '.env');"

      - name: Install Composer Dependencies
        run: composer install --no-dev --no-interaction --prefer-dist

      - name: Generate key
        run: php artisan key:generate

      - name: Directory Permissions
        run: chmod -R 777 storage bootstrap/cache

  deploy:
    name: Deploy to UAT
    needs: integration-test

    runs-on: ubuntu-latest

    steps:
      - name: Checkout Code
        uses: actions/checkout@v2

      - name: Deploy to EC2 instance
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.EC2_HOST }}
          username: ${{ secrets.EC2_USERNAME }}
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          envs: ACCESS_TOKEN
          script: |
            cd /var/www/html/
            git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github.com/".insteadOf "https://github.com/"
            git pull
            composer install
            php artisan migrate --seed
            sudo chown -R www-data:www-data .

ubuntu amazon-ec2 github-actions
1个回答
0
投票

尝试将

checkout
升级到 v4 并清除操作缓存。

© www.soinside.com 2019 - 2024. All rights reserved.