-1

I'm using Github Pages to build my portfolio webpage. I've already built part of the website(it is online) and I get an error every time I try to update it.

The main HTML file for the webpage is named index.html. I am trying to add buttons to the website, so I added the buttons in my index.html file and saved it. Then I perform the following commands in my terminal (In the repository, of course):

git add index.html 
git commit -m "Adding buttons" 
git push origin master

Then I have to enter my username and password. I get the following error:

 To https://mywebsiteurl
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://mywebsiteurl'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

How do I solve this error and push the changes to my repo?

jimpix
  • 147
  • 4

1 Answers1

0

You need to do a pull.

You or someone who has access to your repo pushed some changes which you don't have on your local version. Try following,

git pull origin master

It might be possible, you may find some CONFLICTS, just search for <<<< in file specified as conflicted. Read here more on How to resolve merge conflicts in Git?

Community
  • 1
  • 1
Gaurav Gandhi
  • 3,041
  • 2
  • 27
  • 40