-1

I have my github website deployed to a.github.io. Now, I have made some changes locally and want to push changes but I am unable to do so. This is what the settings of my repo says in the Github Pages section:

enter image description here

In my repo, I can see that the commits are being shown. However, the website is still not updated. If I run it locally, i see the changes but not on the actual website. Note that the original account where website it hosted is also different than the one through which I am making commits.

When I go to my local repo through terminal and run

git config --list

Instead of my username and email, I get two different emails of my two different accounts. The first user.name is basically my email for where I am hosting the website. The user.email is the email through which I am pushing changes.

user.name= ab@hotmail.com user.email=ab@gmail.com

This is how I am trying to update the website (the pushing worked last time but it's not even working rn):

git add *
git commit -m "added new picture"

Results:

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
    deleted:    favicon.ico
    deleted:    logo192.png
    deleted:    logo512.png
    deleted:    z<

no changes added to commit
git push

Result:

 ! [rejected]          master -> master (fetch first)
error: failed to push some refs to 'https://github.com/aa
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.

and then npm run deploy

  • Does this answer your question? [git: updates were rejected because the remote contains work that you do not have locally](https://stackoverflow.com/questions/24357108/git-updates-were-rejected-because-the-remote-contains-work-that-you-do-not-have) – phd Mar 04 '20 at 14:43
  • https://stackoverflow.com/search?q=%5Bgit%5D+hint%3A+Updates+were+rejected+because+the+remote+contains+work+that+you+do – phd Mar 04 '20 at 14:43
  • @phd Nope, even when the push is successful, the website is not making changes live –  Mar 04 '20 at 15:37

1 Answers1

1

Try to pull first and then push.

git pull

Edit:

If there are merge conflicts after pulling you need to solve them before pushing again.

Warning: This is not recommended option, but if you are the only developer working you can use force for your commit. This will delete past commits, use it with caution.It can change history of other people on the same project.

git push -f origin master
stubborn
  • 180
  • 1
  • 4
  • 14
  • I tried using pull last time but then all my original files would be changed into static and other folders that are normally visible in a .github.io website repo. –  Mar 04 '20 at 15:33
  • I used this push command. The push was successful but the website is still not updated –  Mar 04 '20 at 15:33
  • 2
    I suggest wait a little bit. Normally when I push to github pages it takes about 10 minutes in order to see the changes. Also don't forget to clear your browser cache. – stubborn Mar 04 '20 at 15:57
  • It's still not changed. I even checked from another browser. I'm afraid the problem might be somewhere else –  Mar 04 '20 at 16:50
  • Are the changes you pushed visible in the github repo? Did you pushed with the same username you said it worked last time? You can also try deactivate and activate GitHub Pages again. Also you can checkout this post - [link](https://stackoverflow.com/questions/24713112/problem-is-my-github-page-do-not-update-its-content) – stubborn Mar 04 '20 at 18:19
  • Yup, the commits are shown on my github repo but changes aren't going live. I tried almost everything on the link but nothing seems to work for me. –  Mar 04 '20 at 23:05
  • Also, I just got this email from Github ```The page build completed successfully, but returned the following warning for the `master` branch: It looks like you're using GitHub Pages to distribute binary files.``` –  Mar 04 '20 at 23:11