Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot push to github repo

Tags:

My repo: https://[email protected]/shadyabhi/learnajax.git

shadyabhi@archlinux-N210 ~/github/learnajax $ cat .git/config 
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://[email protected]/shadyabhi/learnajax.git
    fetch = +refs/heads/*:refs/remotes/origin/*
shadyabhi@archlinux-N210 ~/github/learnajax $ git config -l
user.name=shadyabhi
[email protected]
merge.tool=vimdiff
github.token=1095de7027bVVVV01cfAAAAAa5fc8f6
color.ui=auto
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://[email protected]/shadyabhi/learnajax.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
shadyabhi@archlinux-N210 ~/github/learnajax $ git push -u origin master
Password: 
fatal: Authentication failed
shadyabhi@archlinux-N210 ~/github/learnajax $ 

Now, I cant push into my repo. I have checked the github.token its the same as my Account Settings. Ofcoarse, I am entering the right password but I get this error.

like image 998
Abhijeet Rastogi Avatar asked Mar 30 '11 12:03

Abhijeet Rastogi


People also ask

Why git push is not working?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

How do I force a code to push to GitHub?

To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch).


3 Answers

I was having a similar issue pushing my origin with the correct user and password. It turned out that I had turned on 2-factor Authentication and had forgotten. If you have 2-factor Authentication enabled you will need to create an application specific password to push your repo. https://help.github.com/articles/creating-an-access-token-for-command-line-use

like image 134
Kelley Kavanaugh Avatar answered Sep 30 '22 06:09

Kelley Kavanaugh


There is some issue (if using https) if username contains "some" special characters.

like image 38
Abhijeet Rastogi Avatar answered Sep 30 '22 04:09

Abhijeet Rastogi


As I understand it, github.token (and github.user) aren't used by git HTTP transport - they're only there for other tools that use GitHub's API, such as GitX and GitNub.

I think the "Authentication failed" error must be due to you entering the wrong password. (This should be your GitHub password rather than the password to your SSH private key.)

like image 42
Mark Longair Avatar answered Sep 30 '22 04:09

Mark Longair