Issue deploying Hugo site to github pages, using github actions

I’m having trouble with the final deploy, and have followed @peaceiris instructions for setting up a deploy key and secret and have uploaded the Github action, as documented in the HUGO docs (Host on GitHub | Hugo).

I have changed line 33 in the Github action to:

deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}

As documented here: GitHub Pages action · Actions · GitHub Marketplace · GitHub

However, I’m getting an error on the deployment, which is as follows:

/usr/bin/git push origin gh-pages
  fatal: unable to access 'https://x-access-token:***@github.com/jonathanthomas83/guitar.git/': URL using bad/illegal format or missing URL
  Error: Action failed with "The process '/usr/bin/git' failed with exit code 128"

The only thing I can think of is that I’m using Two-Factor Authentication and perhaps this is why the “***” is happening? Either way, I am really struggling to understand how to fix this and would greatly appreciate some help :slight_smile: Thank you for your time!

Here’s my latest deployment error:

Setup auth token
  [INFO] setup SSH deploy key
  /usr/bin/chmod 700 /home/runner/.ssh
  [INFO] wrote /home/runner/.ssh/known_hosts
  /usr/bin/chmod 600 /home/runner/.ssh/known_hosts
  [INFO] wrote /home/runner/.ssh/github
  /usr/bin/chmod 600 /home/runner/.ssh/github
  [INFO] wrote /home/runner/.ssh/config
  /usr/bin/chmod 600 /home/runner/.ssh/config
  /usr/bin/ssh-add /home/runner/.ssh/github
  Error loading key "/home/runner/.ssh/github": invalid format
  Error: Action failed with "The process '/usr/bin/ssh-add' failed with exit code 1"

The only thing I can think of is that I’m using Two-Factor Authentication and perhaps this is why the “***” is happening?

I am sure 2FA is not related to this feature.

Did you follow the instruction correctly to create and register private/public keys? Create SSH Deploy Key - peaceiris/actions-gh-pages

Also, the following questions can help you.

1 Like

Thank you @peaceiris, I’ll spare you the details. But I’ve spent the last couple of days troubleshooting and trying various things. Turns out that upon returning to the original Deploy Key method, I wasn’t copying and pasting in the common way, but rather in a way to prevent line breaks. Solved and thank you for your time. Your answer helped! :slight_smile:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.