Couldn't find github in keychain MacOS - macos

August 13th, github no longer accepts password for git actions. So, to update the token, I would have to change the password field in the keychain (github keychain) to token as recommend.
But, Unfortunately I couldn't find my keychain related to github.
Where can I find the keychain for github, and edit it so that git actions works ?!

Have you tried to put your token as password for git action? When git asked for the password, just put your token as password.
If you have never logged in to GitHub yet, then you will not find GitHub in the keychain. Make sure when you generate token you checked all the scopes you need.

Assuming git config credential.helper does return osxkeychain, not finding github.com in it means: the helper is ready to cache your new credentials.
A new git push should display a prompt where you would enter your GitHub user account name, and your PAT (Personal Access Token).
Check first nothing was cached with:
printf "protocol=https\nhost=github.com"| git-credential-osxkeychain get
If it was, you could remmove it with the erase command:
printf "protocol=https\nhost=github.com"| git-credential-osxkeychain erase

I had the same problem and i solved that by connecting my github account via fork.
it will help you to solve this problem.

Just open KeyChain Access, then create a new entry >Passwords> click on the notepad symbol on the top right> in the keychain item name enter the url > then enter the username of the repo > copy the token into the password section.

First, you need to generate your PAT on GitHub.
Then go back to your terminal: run a git command, input your GitHub username and use your token in place of your password.

You can download github desktop - https://desktop.github.com/
You can signin with your github credentials and you can clone and push/pull your code.

Related

Can't log in to Github for Mac client after changing my computer's name

I changed my computer's name, and now I cannot log into the Github for Mac client. When I try to log in through the "preferences" section in Github for Mac, I get a "Login or password is incorrect" message. I am certain that they are in fact, correct.
I figured this had something to do with my SSH key being tied to my computer name, so I generated a new SSH key.
After changing my SSH key, and adding it through github.com, I ran:
ssh -T git#github.com
I get the success message:
Hi alexweissman! You've successfully authenticated, but GitHub does not provide shell access.
I also did
git config --global user.email <my-email-address>
Which seemed to work without any complaint.
Strangely, when I attempt to sync a commit, and it prompts me for my username and password, it accepts it without any complaint. I suspect that Github for Mac has cached my old SSH key somewhere and is somehow trying to use that in conjunction with the "remember me" feature.
I am running OSX 10.8.5.
Try this:
Go to https://github.com/settings/applications and revoke the access to GitHub For Mac. Then try the login

How do I make Git ask for a username and password every time I push?

Where I work many people use the same computer on the same account. We now use the shell instead of the GUI just for convenience.
The first time someone committed it asked for their username and password, but after that just used their account for all commits. I'm sorry that I don't know much about the shell, but this is the first time I'm using it. The commands I use to commit and synchronize are:
git commit -a
git push origin [branch name here]
If you use a Windows system, the Git username and password is stored in a control panel. You can go to Control Panel → User Accounts → Credential Manager:Generic Credentials to delete it.
It seems that users credentials are being cached.
Go to your project, open .git/config and remove the lines:
[credential]
helper = store
# or helper=cache
Check git-credential-store for more information.
Edit: OP mentions in the comments that this is happening in Windows, for which, the other answer is more relevant for removing the credentials from the Control Panel.
1.Go to your Repository folder (on PC).
2.Use HTTPS protocol instead of SSH, You'll get it while cloning.
git remote set-url origin https://....
3.git credential-cache exit
4.Done!
To revert it back to NOT ask password everytime:
1.Copy SSH key (~/.ssh/id_rsa.pub) from your device.
2.Paste it to Account --> SSH & GPG keys --> New SSH key.
3.Use SSH protocol instead of HTTPS, You'll get it while cloning.
git remote set-url origin git#:..//....

Pycharm GitHub 'Push failed: fatal: Authentication failed'

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.

Clone repository from github in xcode userid password error

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.

How do you reset the stored credentials in 'git credential-osxkeychain'?

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.

Resources