1

I have my portfolio deployed to my account on a.github.io.

I made some changes but they're not going live on the website. In fact, even though I make changes on visual studio, the commit section does not show any commits.

If i commit changes, I get

On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
modified: node_modules/gh-pages/.cache/github.com!a!a.github.io.git (new commits)

no changes added to commit 

even though I am making changes.

So my changes aren't going live.

Edit:

Now, the commit worked but I get this when I push changes:

 ! [rejected]          master -> master (fetch first)
error: failed to push some refs to 'https://github.com/a/a.github.io.git'
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.
x89
  • 2,798
  • 5
  • 46
  • 110

1 Answers1

0

If you have made any changes, a git status should show them, and you should have done at some point a git add + git commit.

If the push still fails, check if your git status shows you a branch.


If not, you are in detached HEAD mode, which would explain why a commit is not pushed.

git switch -c tmp
git switch -C master tmp

That would then reset master to that current (detached HEAD) commit.


If you get:

new file...

At minimum you would need to do a git add+git commit, but again, double check the current branch.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • If I do git status, I get ``new file: src/assests/font-awesome/svgs/solid/archway.svg``` for literally everything – x89 Mar 01 '20 at 21:02
  • It says ```git: 'switch' is not a git command. See 'git --help'.``` – x89 Mar 01 '20 at 21:06
  • I haven't used git a lot in the past. Could you please explain me as a beginner? – x89 Mar 01 '20 at 21:06
  • @x89 git switch is Git 2.23+: can you update easily? On which OS are you? – VonC Mar 01 '20 at 21:08
  • @x89 First, what does `git status` return? – VonC Mar 01 '20 at 21:09
  • git status returns ```new file: src/logo.svg new file: src/portfolio.js new file: src/serviceWorker.js new file: z< ``` for all files – x89 Mar 01 '20 at 21:20
  • I'm using Linux-Ubuntu – x89 Mar 01 '20 at 21:21
  • @x89 Does git status display first "`On branch xxx`"? And what does `git version` return? – VonC Mar 01 '20 at 21:22
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/208810/discussion-between-vonc-and-x89). – VonC Mar 01 '20 at 21:22