0

I am trying to get a public github page from a private source repo following this tutorial which utilizes PUBLIC and PRIVATE key variables from ssh-keygen -t rsa -b 4096 -C "$(git config user.email)" -f deployment -N ""

I have the same setup as described in the link, but I am not able to wrap my head around what is actually not working.

By using the same GitHub action

name: Github Pages

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  deploy:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true  # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: '0.83.0'

      - name: Build
        run: hugo --minify

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          deploy_key: ${{ secrets.PRIVATE_KEY }}
          external_repository: <username/username.github.io>
          publish_dir: ./public

It does not build because

Error: Unable to locate config file or config directory. Perhaps you need to create a new site.Run `hugo help new` for details.

Then I replaced the entire workflow with the one suggested by [Hugo] (https://gohugo.io/hosting-and-deployment/hosting-on-github/) which is much more recent. I then added to the last deployment action

   steps:
       - name: Deploy to GitHub Pages
         id: deployment
         uses: actions/deploy-pages@v2
         with:
           deploy_key: ${{ secrets.PRIVATE_KEY }}
           external_repository: <username/username.github.io>
           publish_dir: ./public

which fails with

Error: Get Pages site failed. Please verify that the repository has Pages enabled and configured to build using GitHub Actions, or consider exploring the `enablement` parameter for this action. Error: HttpError: Not Found

I have set up both deploy keys and private keys as well as the urls seems to be correct and in the public repo I have the following setup for pages

Deploy from branch, brain main and /root. In the previous tutorial they mention a gh-page source but it is not available (I have nothing else beside main). Should there be an additional branch?

Sorry for the long post and thanks for any help!

D.A.
  • 140
  • 1
  • 12
  • Do you have GitHub Pro or Team? On a free personal account, you can't have Pages on a private repo. – Benjamin W. Jun 27 '23 at 15:42
  • I have the source on private but the page is deployed from a public repo, check the link here for details on which settings am I using https://dev.to/importhuman/deploy-hugo-website-using-github-pages-1mc5 – D.A. Jun 28 '23 at 07:29
  • deploy-pages [doesn't support](https://github.com/actions/deploy-pages/blob/main/action.yml) `external_repository`, that's specific to peaceiris/actions-gh-pages. I recommend you use a single repo and make it public, and use the [official Hugo starter flow](https://github.com/actions/starter-workflows/blob/main/pages/hugo.yml). – Benjamin W. Jun 28 '23 at 14:19

0 Answers0