Failing to update page

I followed the instructions on github pages, the last command didn’t work so I used “git checkout -b master” Then it worked, but now when I try to push updated versions of index.html, no changes occur.

git checkout -b master would have created a new branch called master, which likely means your already existing code is on an existing branch. The default branch name has been changed to main a while back.

You need to make sure to push to the branch that’s currently published, or if you really want to use a different branch go to the repository setting and select that branch for Pages.

I tried git push -u origin main, and got

Total 0 (delta 0), reused 0 (delta 0)
c75e3d5…dbc355e main -> main
Branch ‘main’ set up to track remote branch ‘main’ from ‘origin’.

I tried updating the page with:
git push -u origin main

now when i use git push index.html I get:
fatal: invalid gitfile format: index.html
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

You can’t push a file. You need to commit the file to the branch that’s being published, and then push the branch.

Here’s the Github documentation on pushing:

For a general introduction to git I highly recommend the Git Book, especially chapter 2.

thanks for the help, I was able to get it working after some messing around

1 Like