cp:无法统计‘~./project_name/*’:没有这样的文件或目录

cp:无法统计‘~./project_name/*’:没有这样的文件或目录

项目位于分支 main 上。在推送到 main 时从路径 ~./project_name/output 部署到分支 gh-pages。系统:ubuntu 20.04 到 wsl2。cp -r 命令应指定哪些路径(参数)以将 avto-deploy 到 github pages?从日志中:

Push
Run run: |
/home/runner/work/_temp/9db87e3f-eb64-4189-a66b-8e958587ada6.sh: line 1: run:: command not found
warning: re-init: ignored --initial-branch=gh-pades
Reinitialized existing Git repository in /home/runner/work/project_name/project_name/.git/
cp: cannot stat '~./project_name/*': No such file or directory
Error: Process completed with exit code 1.

文件内容 ~./project_name/.github/workflows/main.yml:

name: Deploy to GitHub pages


on:
  push:
    branches:
      - main

jobs:
  deploy:
    environment: production
    runs-on: ubuntu-latest
    permissions:
      contents: write
      packages: write   
    steps:
      - uses: actions/checkout@v2
        with:
          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
          fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
      
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true

      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: "16"
          cache: "yarn"
      - run: yarn install

      - name: Build
        run: bin/bridgetown deploy

      - name: Push
        run: |
          run: |
          cd output
          git config --global user.email "useremail"
          git config --global user.name "username"
          git init --initial-branch=gh-pades
          touch ./.nojekyll
          cp -r ~./project_name/* ./
          git add -A
          git commit -m 'deploy'
          git push -f https://username:${{ secrets.GITHUB_TOKEN }}@github.com/username/project_name.git gh-pages

答案1

-          cp -r ~./project_name/* ./
+          cp -r ~/project_name/* ./

相反~./,您可能希望~/以绝对方式引用您的主目录,或者./以相对方式引用您的当前目录。

相关内容