I've read the guide, which tells you to do the following:
path/to/repo
I've done that. And the page shows up. Then I moved to a different computer and checked out the repository again. Now I have a "master
" branch in my local, but no "gh-pages
." And following steps 3-6 above leaves me with no files in that branch. How do I get the files from "master
" into the branch that will publish to GitHub?
I tried git checkout master && git push origin gh-pages
but that yields
error: src refspec gh-pages does not match any.
fatal: The remote end hung up unexpectedly
error: failed to push to '[email protected]:<me>/<me>.github.com.git'
Under your repository name, click Settings. In the "Code and automation" section of the sidebar, click Pages. To see your published site, under "GitHub Pages", click your site's URL. Note: It can take up to 10 minutes for changes to your site to publish after you push the changes to GitHub.
You can publish a package to GitHub Packages to make the package available for others to download and re-use.
You can configure your GitHub Pages site to publish when changes are pushed to a specific branch, or you can write a GitHub Actions workflow to publish your site. People with admin or maintainer permissions for a repository can configure a publishing source for a GitHub Pages site.
Apparently subsequent pushes to "origin master
" actually do the trick! It's not documented in the guide, though.
As Gaius says, you are following the directions for 'Project Pages', but you are not trying to create a project page, you are trying to create a user page. Creating a user page is much easier - you just create a '.github.com' repository then push your website files to it's master branch, like you would any other normal project.
The instructions you are trying to follow are for adding a parallel branch containing website files to an already existing project. We don't want to make you add a 'website' subdirectory or something to your project, so instead we have you create a completely new branch and push your website to that unrelated branch - thus the Git trickery there.
To work on a branch of a fresh remote repository checkout you will first need to create the branch locally. Here is an example for a “gh-pages
” branch:
git checkout --track -b gh-pages origin/gh-pages
More details in this article "Migrating project websites to github pages"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With