Newbie question: very first commit failed due to typo in password. How do I fix this? #21842
-
I am rather new to Git/GitHub so I only have a basic knowledge of the basic concepts. I am developing some vue.js code in Visual Studio Code and trying to push my code to the remote repository on GitHub. (I *think* I have successfully staged and added my code to the local repository.) When I did my very first push of my code to a new GitHub repository, I believe I made a typo in my password and the push failed on an authentication error. That seems pretty reasonable to me. I assumed that simply trying the push again would give me another chance to type the password, get it right this time, then do the push successfully but that isn’t what happened. The Git log doesn’t want to let me push and thinks I might need to do a pull, which doesn’t make a lot of sense to me because this is the very first push to master, in a new GitHub repository and I am the only person developing on this little project. I have no idea how to proceed and finish my push. Can anyone advise me? For what it’s worth, I tried a pull even though it didn’t seem appropriate but it didn’t work and my subsequent attempt to push failed too. Here’s the relevant bit of the Git log:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @hughcan, Welcome to the Github Community Forum! Ok I try to help understand what is going on, let’s take the first two commands:
When you fail to authenticate there is no problem, so you try another time and it give you an error and reject the push to master. This can happend if there are some commits in the branch on remote that you don’t have in your local machine and I think this is what is going on. There is a README.md file in your remote repository that you don’t have in the local repository. if you want to be sure you don’t lose any commits done locally, you can first create a new branch using this command:
Using branching you can safely put somewhere what you have done and not loose anything. Then run this command:
The pull command need the remote and the branch from where to pull, in your case the master branch is located in the origin remote on github. Can happend 2 things: the pull will be rejected or the pull use a merge strategy to align the master branch on you local machine. In the first case the procedure can be ugly, but we can do anything using git and some command. If everything goes ok, you can now push like you tried to do previously and remove the branch created with the branch command:
Let me know if this solve the problem :slight_smile: -Gabriele- Mark helpfull posts with Accept as Solution to help other users locate important info. Don’t forget to give Kudos for great contents! |
Beta Was this translation helpful? Give feedback.
Hi @hughcan,
Welcome to the Github Community Forum!
Ok I try to help understand what is going on, let’s take the first two commands: