"Nothing to commit" after failed authentication

Asked

Viewed 372 times

1

I have a question about git. Namely when we failed to authenticate, the commands and actions I took were:

  1. Change in ficheiro.c
  2. commando git add .
  3. commando git commit -am 'lol' && git push origin master
  4. request for authentication
  5. failed authentication
  6. Repeat command of step 3, where the output is:

On branch master
Nothing to commit, Working directory clean

However the push did not work, the changes (point 1) are not in the reset

  • It has to be just git push origin master now. Commit already done, push failed.

  • @LINQ yes, I think it works. You can answer below

  • ready.

2 answers

3


The commits are local, on your machine. So what failed was just the push.

Instead of repeating the command

git commit -am 'lol' && git push origin master

Just make a push

git push origin master

2

The message:

On branch master Nothing to commit, Working directory clean

says that you are in the master branch and there is nothing to commit in your working directory, because in:

git commit -am 'lol' && git push origin master

The left side of your && had already been executed, and therefore when you reexecute all step three receives this message.

Whenever there is a commit your working directory will be clean, this can be checked using the command git status.

All that remains is to resend the local commit to the remote server using the command git push origin master which is the right side of your step three.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.