Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

Newbie question: very first commit failed due to typo in password. How do I fix this?

Solved! Go to Solution.

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:

> git push -u vue_crash_todolist master
Logon failed, use ctrl+c to cancel basic credential prompt.
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/HughCan/vue_crash_todolist/'
> git push -u vue_crash_todolist master
To https://github.com/HughCan/vue_crash_todolist
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/HughCan/vue_crash_todolist'
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.
> git pull --tags
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=vue_crash_todolist/<branch> master
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse master
> git rev-parse --symbolic-full-name master@{u}
fatal: no upstream configured for branch 'master'
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
> git config --get commit.template
> git push -u vue_crash_todolist master
To https://github.com/HughCan/vue_crash_todolist
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/HughCan/vue_crash_todolist'
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.
> git push -u vue_crash_todolist master
To https://github.com/HughCan/vue_crash_todolist
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/HughCan/vue_crash_todolist'
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.

 

Spoiler
 
1 Reply
Highlighted
Solution
Commander Lvl 2
Message 2 of 2

Re: Newbie question: very first commit failed due to typo in password. How do I fix this?

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:

 


> git push -u vue_crash_todolist master
Logon failed, use ctrl+c to cancel basic credential prompt.
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/HughCan/vue_crash_todolist/'
> git push -u vue_crash_todolist master
To https://github.com/HughCan/vue_crash_todolist
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/HughCan/vue_crash_todolist'
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.

 

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:

 

git branch new_branch

 

Using branching you can safely put somewhere what you have done and not loose anything.

Then run this command:

 

git pull origin master

 

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:

 

git branch --delete new_branch

 

Let me know if this solve the problem :)

 

-Gabriele-

 

Mark helpfull posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great contents!