11

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.

Trimax
  • 2,413
  • 7
  • 35
  • 59

9 Answers9

14

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.

Amol Kumar
  • 121
  • 1
  • 4
  • 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! – Jaco Apr 02 '20 at 02:32
11

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.

Trimax
  • 2,413
  • 7
  • 35
  • 59
8

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.

Petter Ivarsson
  • 463
  • 6
  • 6
  • 1
    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 Dec 31 '20 at 17:07
  • 1
    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`. – Israel Alberto RV Dec 31 '20 at 17:11
3

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%402010@github.com/{repo_username}/{repo_name}.git

Peter T.
  • 8,757
  • 3
  • 34
  • 32
2

So I found the solution to my problem, and I hope this helps:

If you are using KDE, or Gnome, your "KDE Wallet", or "Gnome Keyring" manager will save your password when you push for the first time. However, if you enter the password wrong, these managers (ksshaskpass for KDE) will store the wrong password and will send the wrong password every time.

To fix this, open the appropriate manager and change the password. With KDE, it is in: Kick-off-menu > System Settings > Account Details > KDE Wallet, then click "Launch Wallet Manager", and find "ksshaskpass", expand it, and then expand "Passwords", then find your github registered email address there, click it, and on the right, click on "Show Contents". Now change that value (in case wrong password), then hit save. and you're done!

Now that means you don't have to type in your password each time for https push, and you don't have to use SSH keys either ;)

1

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.

James Bellaby
  • 158
  • 14
0

Ok guys, I tried all suggested solutions and they did not worked for me.

I use git bash and bitbucket.

Finally I turned it upsidedown, and it worked - at least that way. I know this is difficult and foolish solution, but it worked. So the steps:

  1. you have your code on your local machine.

  2. you have your repo /on bitbucket/

  3. Delete your repo or make a new one with new name

  4. Make a readme.md with the help of the /bitbucket's/ dashbord

  5. clone the new repo

  6. copy your files into this new folder which you want to push

  7. do the git bash work (add,commit) and push it to the repo.

akjoshi
  • 15,374
  • 13
  • 103
  • 121
Imre
  • 341
  • 3
  • 6
0

In PyCharm go to:

Settings > Version Control > Github > + 
  • add credentials
  • AND:

Check your open browsers, when logging in from pycharm into GitHub a tab is opened to authorize Jetbrains the access to your Github account.

Lisa B.
  • 235
  • 1
  • 11
0

I am using High Sierra on an old iMac and originally tried to push a new local project to a new remote.

Unable to get authentication working on Terminal I then tried to use PyCharm as a vehicle to save the authentication token from Github.

In the past I was accustomed to the IDE prompting for the use of a token and even suggesting me to open Github.com to generate the appropriate one.

PyCharm was not able to push a new branch but it did not give any such hints for a solution in the error message

12:56   Push failed
        git@github.com: Permission denied (publickey).
        Could not read from remote repository.
        
        Please make sure you have the correct access rights
        and the repository exists.
        Show details in console

My solution was to go into the settings and there I found the connection to Github unset - and I was able to link a token.

But I also had to set the remote with the HTTPS link. When I tried with the SSH URI it did not work.

enter image description here

bomben
  • 590
  • 6
  • 16