Pycharm GitHub 'Push failed: fatal: Authentication failed'

18,962

Solution 1

I tried all but it worked me charm : The problem I had : Every thing was working from terminal and from Github desktop as well. But when I tried to PUSH/PULL from pycharm it wasn't working. Reason : It happens because by-default pycharm save password locally in DB.

Work around: Go to File > Settings > Appearance & Behavior > System Settings> Passwords, clicked on 'Do not save..", restarted IntelliJ and VCS asked for password again.

Solution 2

It seems there is some issue (if using https) if username or password contains "some" special characters.

So, I've generated a secondary password ("personal access token") in GitHub's application settings page (using the "Create new token" button), I did copy this token. Then I've selected Auth Type: Token in Settings->Version Control->GitHub, and pasted the token.

Testing it: Connection successful for user . Now the git push works perfectly.

Solution 3

I struggled with this problem for half a day using Git in PyCharm.

Solution: Settings => Version Control => Git => ticked "Use credential helper" and then it worked perfect.

Solution 4

If your username or password has special characters, you can replace it with the Percent-encoding for theses characters. 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%[email protected]/{repo_username}/{repo_name}.git

Solution 5

I came across this once. Turned out that the Web Credentials in the Credentials Manager stored an incorrect password for github.com and gitlab.com.

I removed that and it gave me the option to log in when I added a new repository.

Share:
18,962
Trimax
Author by

Trimax

Technology and science fan. Linux and Android user. Amateur Photographer. Now, learning Python dev. Jurist by occupation. Interested in Python, SQL, HTML+CSS,JavaScript, AlgularJS, Google Apps Script,...

Updated on June 09, 2022

Comments

  • Trimax
    Trimax about 2 years

    Every time I try to push a repository in GitHub with Pycharm the it fails.

    Push failed: fatal: Authentication failed for 'https://github.com/(my github repository)/'
    

    In Settings->Version Control->GitHub, I filled the fields Host, Loging and Password (Auth Type: Password). Testing it: "Connection successful"

    In Settings->Version Control->Git, Path to Git executable is seted with the full path, SSH executable: Buil-in

    Pycharm version 3.1.1 Git version 1.8.4.msysgit.0 On Win 7.

  • Ivo Flipse
    Ivo Flipse about 10 years
    I did this, but I'm still getting the error. Testing the connection said it worked, pushing commits to Github fails
  • John
    John over 8 years
    Works like a charm. A pycharm.
  • Jaco
    Jaco over 4 years
    Thanks a lot for this. It is obvious the programmers of PyCharm have got some mental hickup when it comes to git (in my case Bitbucket) and Pycharm. Every time I reinstall pycharm or create new repo, having the same problems,, this is the first time I get a good fix on the problem. amazing that crucial faults that is clearly very negative for the user-experience, like this, keep existing year after year without being fixed. Thanks for the answer!
  • Israel Alberto RV
    Israel Alberto RV over 3 years
    It works. If the error is git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master --tags then you need to check the box for Use credential helper.
  • Israel Alberto RV
    Israel Alberto RV over 3 years
    Other possible problem could be the native Keychain, I am using Arch Linux and looks like it's working better with the KeePass rather than the Native keychain. File | Settings | Appearance & Behavior | System Settings | Passwords -> In KeePass.