Cannot push to github repo

2019-03-11 03:01发布

My repo: https://shadyabhi@github.com/shadyabhi/learnajax.git

shadyabhi@archlinux-N210 ~/github/learnajax $ cat .git/config 
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://shadyabhi@github.com/shadyabhi/learnajax.git
    fetch = +refs/heads/*:refs/remotes/origin/*
shadyabhi@archlinux-N210 ~/github/learnajax $ git config -l
user.name=shadyabhi
user.email=abhijeet.1989@gmail.com
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://shadyabhi@github.com/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.

7条回答
Deceive 欺骗
2楼-- · 2019-03-11 03:46

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

查看更多
时光不老,我们不散
3楼-- · 2019-03-11 03:51

I have hit the same problem just now. Apparently, when you use git in command line, it wants you to enter the access token instead of password. This is really weird, but it works.

$ git push origin HEAD
Username for 'https://github.com':        <--- your username here
Password for 'https://t7ko@github.com':   <--- access token here O_O

PS: This is the instruction on creating token: https://help.github.com/articles/creating-an-access-token-for-command-line-use

查看更多
4楼-- · 2019-03-11 03:52

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

查看更多
Viruses.
5楼-- · 2019-03-11 03:54

I had just same problem as previously described. Passwords with #, ¤ or " didn't seem to work, whatever I tried.

Seems to be more or less similar problem as with Microsoft Office 365 portal, where you can't use ex. ¤ character in password, if you are going to use mobile devices as well.

Github login works fine with all passwords, in web... but using whatever client, it doesn't.

查看更多
\"骚年 ilove
6楼-- · 2019-03-11 03:55

If your password contains special characters, git push won't work in Terminal. My workaround is open up emacs and do git push inside eshell.

查看更多
神经病院院长
7楼-- · 2019-03-11 03:57

if your username or password has special characters, you can replace it with the encoded for example, if your password is "test@2010", you will write it as "test%402010" and the config command will be like this git config remote.origin.url https://{username}:test%402010@github.com/{repo_username}/{repo_name}.git

查看更多
登录 后发表回答