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.
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.
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.
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.
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
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 ;)
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.
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:
you have your code on your local machine.
you have your repo /on bitbucket/
Delete your repo or make a new one with new name
Make a readme.md with the help of the /bitbucket's/ dashbord
clone the new repo
copy your files into this new folder which you want to push
do the git bash work (add,commit) and push it to the repo.
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.
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.
Related
I'm using the latest Github for Mac as a new Git user. When I try to sync a repo (that I first cloned, then created a new branch, commited changes, and then merged with master), I got the error:
Authentication Failed.
You may not have permission to access repo111. Check Preferences to make sure you’re still logged in.
I searched for similar questions, but the answer seemed to be add SSH keys to github, so I followed: https://help.github.com/articles/generating-ssh-keys.
When I do ssh -T git#github.com, I get:
Hi User111! You've successfully authenticated, but GitHub does not provide shell access.
I'm logged in as the correct user, and have rights to the repo, so I'm not sure why I'm not authenticated?
It could be that you entered a password incorrectly and it's stored in your keychain.
For my situation, I was using GitHub for Mac to work with a BitBucket repository. Long story short, I mistyped my BitBucket password and GitHub for Mac could not authenticate (because the password stored in my keychain was wrong).
Thanks to the helpful folks at GitHub, they quickly responded when I asked for help:
Open Keychain Access.app (in /Applications/Utilities) and search for "GitHub for Mac." There should be an entry like "GitHub for Mac — bitbucket.com". Delete that entry
Steps to fix if using GitHub for Mac to manage a BitBucket repo
If you see this:
… then you might have a BitBucket keychain/password problem.
Open Keychain Access.app (in /Applications/Utilities) and search for bitbucket:
Right-click on the entry and get info:
Click on "Access Control" to confirm that it's truly the GitHub for Mac BitBucket password/login keychain item:
Rather than deleting the keychain entry/item, I just edited my password:
You should now be able to use GitHub for Mac without authentication failures. :)
Had the same problem, but it was not a password problem, since other repositories worked just fine.
Finally compared .git/config with a working repository and found this:
This failed:
[remote "origin"]
url = github#github.com/path/to/repository
This worked:
[remote "origin"]
url = https://github.com/path/to/repository
Still have no idea how or why this changed.
I had to try some other stuff after the solutions above didn't work out for me.
Dont know why I got this issue, or why was fixed after:
deleting the existing keys:
.ssh/github-rsa
.ssh/github-rsa.pub
restarting GitHub Desktop, which automatically regens the keys
add new keys to repo host (bitbucket etc)
I had the same problem, then I followed this steps:
Login to BitBucket and go to the repository you want to use
Click the “Clone” button, and change the drop down option to HTTPS.
Copy the command that appears (something like: git clone https://username#bitbucket.org/team-name/repository-name.git)
Open terminal in your mac and navigate to wherever you want the theme files to be stored.
Paste the clone command in the terminal, press enter and then enter your password when requested.
In Github for Mac go to the repositories screen and click the + sign in the status bar.
Select Add Local Repository – and then select the repository of the folder you want to add.
Done
If you have created remote repository on GitHub and merged with local repository or project .
you can add that local repository to GitHub desktop app
than go to Repository > repository settings > Remote >
under remote You'll find primary remote repository (origin)
there's a ssh remote url delete that And
Go to your GitHub account.
Open Your Remote repository
click on Clone or Download
Copy the https URL
paste that in the GitHub desktop app
click on fetch in the Desktop GitHub App
It'll work Great :)
If your password is correct and you still see have this problem, chances are your .git/config file has some miss configuration.
In my case, it had a pushurl value under [remote "origin"] which was not needed (I was working on a cloned project).
Comment that line by adding a # before it and you are good to go :)
Also, if you get an error saying:
This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push
just delete that by doing
rm .git/hooks/pre-push
now you are all set. This happened to me also using github desktop app for mac, with a remote bitbucket repo.
hint: if you commit changes and refresh bitbucket to see the changes, those might not show, but navigate to the root of the project and then back to the file and you'll see the changes. Probably some cache issue but it can drive you mad if you don't know this hint.
I'm trying to push my committed changes to Github using Terminal on Mac OS but
it keeps saying that the access to the repository is denied to my old github user
Permission to myuser/test1.git denied to "OldUser".
fatal: unable to access 'https://github.com/"NewUser"/test1.git/': The requested URL returned error: 403
I found some similar problems but none of the answers worked for me:
First of all Iv'e removed all the SSH keys from my mac and created a new one which I then synced with my github account.
Second, I have set the Global config for git to my new username and email using
git config --global user.name AND user.email
When I changed the user and email in the git local config file in my project dir (thinking at least that would work), I was surprised to see the same error when pushing, with my old user name popping out again.. (I really thought a local config would override any old global values) I just don't know where to look anymore..
There are no git environment variables defined and the SSH keys were all re-created.
seems that the last option is to re-install git which would be a really ugly way out..
Oh! BTW when i'm trying to push to github using the dedicated MacOS app it works just fine! I wasn't surprised a bit because all users reporting this problem said that the app worked for them just fine.. Just thought I mention it!
So, if anyone got an answer (or at least a hunch) it would help me a lot.
BTW when I'm trying to push to github using the dedicated MacOS app it works just fine!
It is possible the gitHub for Mac is using https url, with your GitHub login/password (which GitHub for Mac is caching).
Check the url associated with your remote origin:
git remote -v
If it is an https url (like your error message suggests "unable to access 'https://github.com/"NewUser"/test1.git/'"), no amount of SSH fiddling will change that error.
Maybe, for http url, the Credential Caching on Mac OS X has still the old credentials.
I had the exact same error on Windows and apparently it's a Git problem. Thanks to ayan4m1 at github forums (https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/152) I finally fixed this issue in Windows using notepad in admin mode to delete the credential.helper = manager lines from the C:\Program Files\Git\mingw64\etc.gitconfig file. Nothing else worked.
Apparently since I was in non-elevated mode in Git bash from my IDE none of my global commands were able to overwrite the global file. Hope this helps and saves time for someone else with this issue.
I am having troubles when I connect with my repository through Xcode.
I have a Gitlab version (full pre-)installed on TurnkeyLinux Virtual Appliance on a remote server.
In the Gitlab Web interface, I've created a new test user: "testuser" with a password "password" and a new project "testproject". This user was assigned to this project.
The git url project are:
HTTP: http://example.com/testuser/testproject.git
SSH: git#example.com:testuser/testproject.git
I can see the repositories folder rightly created with a "Terminal" through SSH connection.
Now, I want add this git repository to my Xcode repositories.
So, In
XCode > Preferences > Account
I'm trying add it, using both urls and my user credentials, but always receive the following message:
"Authentication failed because the name or password was incorrect."
Could anyone help me?
The user/password would only be needed for an http url, not an ssh one.
When using the http url to add a repo in your XCode Accounts, make sure there is no proxy which would prevent the resolution of the example.com server.
If it is still not working, then, as in "Authentification issue when pushing Xcode project to GitHub", try to use an url like:
https://testuser:password#example.com/testuser/testproject.git
Even if the problems seems solved I've found this question when I had the problem using XCode 10.
I tried logging in to GitHub and got the same error. The workaround described didn't fix my problem but I've found another solution on my own which I'd like to share – maybe it helps somebody ;)
My GitHub password included an 'ä' character (I'm German) and seems XCode and GitHub don't support the used encoding. After changing my password to something without an 'ä' it worked fine. Maybe it wasn't because of the 'ä' but it already helped to change the password - I don't know.
Thank you, but the reasons are Xcode seems a little crazy…
In
Xcode > Source Control > Test Project (master) > Configure Test Project…
I've just added my repository HTTP URL and credentials were not needed, and when I trying push/pull actions Xcode ask me for user/password.
Seems to be Repository in Preferences > Account doesn't work fine…
you'd better use the project configuration:
‘Source Control’ > ’(project name)-Master’ > ‘Configure (project name)’,
select ‘Remote’, choose ‘+’ > Add Remote
Name : origin
Address : git#gitlab.com:xxx/yyy.git
(Curiously it appears after this in the XCode prefs)
Don't forget: using SSH, the password is the one you used (keygen) when building the key !
I don't want to use HTTP! Key file under "git" user is very convenient and secure, I'm not going to type my password in a unencrypted URL entry in some plist file.
In my case, the problem was that Xcode was trying to use the wrong key file : .ssh/id_rsa instead of .ssh/id_dsa
Here using Xcode 7.3.1 and finally managed to push using ssh (and Gogs as github server) by doing so:
1) select the correct private key (there must also be the public key file present)
on Gogs side:
2) add that same key from the Gogs user Settings->SSH Keys
3) under admin panel: Dashboard: Operations: rewrite the authorised_keys file
Done
Open xcode then click "Connect to a repository"
After entering the URL the button on the bottom changes to clone. FYI The repository is private and should require a github password and userid. Clone button is then clicked.
It asks where to save the file. I choose a location then it comes here:
Always trust github.com is chosen as suggested in another post. Click Continue then get the following:
At this point it has not asked me for my username or password at any time. Looking around here and on other sites it should ask for user id and password at this point but this is all I get.
How can I get to the screen asking me to enter my Github user id and password when cloning a private repository on github.com in xcode?
This is a glitch in xCode. You will have to install git and repair/prepare the repository from the git command line or another git tool then reopen the project in xCode and then it will be recognized.
xCode is great for git when it works but will break sometimes and need manual repair/tweaking of a repository outside of xCode. You should think of the git features of xCode as a great aid to using git but not a complete interface replacement.
You can try that way:
Open Terminal application.
cd to your project directory. (cd /your/project/directory)
Write git clone https/link/for/your/git.
Put password for the git user.
It will start download on your project directory.
It seems to work using the git#github.com:user/repo.git URL format if you have your public SSH key set up properly on your Mac (and the private key is not protected by a passphrase).
When xCode logs in via SSH to clone the repo, it will be able to do so without you having to provide any credentials. Note that this will probably only work where you have SSH (read/write) access to the repo in question. Since with Github you are likely to be forking another project and working on your own fork, this shouldn't be too much of an obstacle though.
I've followed the GitHub instructions for setting up my account, and I'm able to clone, but I'm unable to push remotely.
When I do a "git push" I get the 403 error. It has the correct URL. I tried a "git credential-osxkeychain get" to see what it was giving, and this prints out the wrong credentials.
I believe what happened is the first time it asked for the credentials, I thought it was another application asking, and it put the wrong ones in.
I just need to reset it so that it uses the correct keychain item for my GitHub account.
I've tried:
git credential-osxkeychain erase
git credential-osxkeychain set
The program never gives any prompts. Set will say "bad input" if I don't do the right thing. I tried putting in "password=password", etc., but then when I do a "get" I still get the old ones.
I can't figure out where these are being stored, as they are not in .gitconfigure. Further there are no recent keychain items that could be it. (I have several GitHub accounts in my keychain and it is not using any of them.)
From Terminal:
(You need to enter the following three lines)
$ git credential-osxkeychain erase ⏎
host=github.com ⏎
protocol=https ⏎
⏎
⏎
NOTE: after you enter “protocol=https” above you need to press ~~RETURN~~ TWICE (Each '⏎' is equivalent to a 'press enter/return' )
I'm not sure how to erase through the command line, but it's fairly easily to do it through the Keychain Access app. Just go to Applications -> Utilties -> Keychain Access, then enter "github.com". You can either delete the invalid item or update the password from with the app.
The solution turned out to be this:
The command git credential-osxkeychain was using the first GitHub account entry in my keychain. This one was not the one that had access to the projects in question.
I resolved the problem by touching the account in Keychain Access so that its date changed (I think I just changed the comment) and now that it became the most recent GitHub account it became the first one returned to credential-osxkeychain, and thus everything worked.
A better form of support for multiple GitHub accounts would be nice, but it is likely that most people only have one primary account and don't run into this problem.
Try this in your command line.
git config --local credential.helper ""
It works for me every time when I have multiple GitHub accounts in OSX keychain
On Mac, use the command git credential-osxkeychain erase.
OR remove manually from keychain from Applications → Utilities → Keychain Access. Then remove the github.com keychain. Then use push; it will ask for the keychain access; then deny.
It will ask for the new username and password, add it then pushes a file for that.
After git push I found this error. Then I use the upper case-
issue:
remote: Permission to user1/file.git denied to user2(previously exist
user ). fatal: unable to access 'https://github.com/xxxxxxxxxxxx/':
The requested URL returned error: 403
git-credential-osxkeychain stores passwords in the Apple Keychain, as noted above.
By default, gitcredentials only considers the domain name. If you want Git to consider the full path (e.g. if you have multiple GitHub accounts), set the useHttpPath variable to true, as described at http://git-scm.com/docs/gitcredentials.html. Note that changing this setting will ask your credentials again for each URL.
You can delete existing credentials and add new ones via "Keychain Access"
Ref. https://docs.github.com/en/github/getting-started-with-github/updating-credentials-from-the-macos-keychain
GitHub help page for this issue:
https://help.github.com/articles/updating-credentials-from-the-osx-keychain/
Try running /Applications/Utilities/Keychain Access.