Search code examples
github-actionsgithub-pages

fatal: could not read Password for 'https://***@github.com': No such device or address


I'm currently starting to learn how to use Github Actions, and I ran into an authentification issue, where Github is able to retreive my username, but not my password, here's the error (the error occured on Deploy to GH Pages) :

create mode 100644 static/media/flow.edad2ac1.svg
create mode 100644 static/media/plugin.d494b228.svg
create mode 100644 static/media/repo.6d496322.svg
create mode 100644 static/media/stackalt.dba9fbb3.svg
fatal: could not read Password for 'https://***@github.com': No such device or address

I was trying to deploy to GH Pages, here's the code :

  deployToGhPages:
    name: Deploy to GH Pages
    needs: [lint, tests]
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup
        uses: actions/setup-node@v2
        with:
          node-version: 16

      - uses: actions/cache@v2
        id: cache
        with:
          path: |
            node_modules
            */*/node_modules
          key: ${{ secrets.CACHE_VERSION }}-${{ runner.os }}-yarn-cache-${{ hashFiles('**/yarn.lock') }}

      - name: Yarn Build
        run: yarn build
      - name: Build Storybook
        if: steps.cache.outputs.cache-hit != 'true'
        run: yarn build-storybook
      - name: Deploy to GH pages
        uses: nicoinch/[email protected]
        env:
          BUILD_DIR: storybook-static/
          GH_PAT: ${{ secrets.GITHUB_TOKEN }}

First ever question here, if I forgot to include any information, let me know !


Solution

  • Update here ! (Yeah, that was quick)

    When using nicoinch/[email protected] (page here), you are requested to use a PAT (Private Access Token) to make it work.

    I updated my code to this :

    - name: Deploy to GH pages
            uses: nicoinch/[email protected]
            env:
              BUILD_DIR: storybook-static/
              GH_PAT: ${{ secrets.GH_PAT }}
    

    I created a PAT for my Github Account (see here) and placed it in the secrets of the repo (see here), the secret being named GH_PAT.

    Funny how I instantly found the answer after asking it on StackOverflow, I actually spent more than 10 hours searching for this solution, haha.