Git hangs indefinitely - broke with osx credential helper I think
Asked Answered
P

3

4

I got tired of typing my password for my bitbucket repo so I looked up a way to use ssh keys but happened upon the osx credential keychain. I thought I had installed it all correctly by following along with what was instructed in the git-scm book but something bad happened...I can't use git at all!! I then went and rm'd the credential-osxkeychain but that didn't fix my issue, neither did uninstalling and reinstalling git.

If I go into a repo that I had previously pulled down, change a file and run git status it hangs indefinitely.

If I make a new directory, cd into it and run git init that will hang indefinitely as well.

When I run git without any arguments the following is printed out: Usage: git credential-osxkeychain <get|store|erase>. I already looked at my /Applications/Utilities/Keychain Acces.app but I couldn't find anything to change. At this point I just want git back...I'm fine with typing my password.

For reference I am using OSX 10.7.2

edited to add: which git returns /usr/bin/git

Petro answered 27/9, 2012 at 2:40 Comment(0)
S
4

Try "git" status (with the quotes). If that works, you've aliased git to something else (probably alias git="git credential-osxkeychain"), and you should look in ~.profile to see if you can remove the alias.

(See the attached commentary for the debugging steps and eventual resolution).

Steelyard answered 27/9, 2012 at 2:44 Comment(10)
I thought it was \ that made it go around aliases. I tried both regardless, neither worked. I also looked in .bash_profile, .bashrc and .gitconfigPetro
\ works too; I'm just used to "...". Did you perchance replace git with some sort of wrapper? What does which git produce?Steelyard
just edited my post to say which git returns /usr/bin/gitPetro
less /usr/bin/git produces binary gibberish? Maybe use Instruments.app or dtrace to figure out what this apparently-modified git is doing?Steelyard
yeah, binary gibberish indeed. actually...some of it is legible for whatever reason. and it says something like /usr/local/share/git-core/contrib/credential/osxkeychain or /usr/local/Cellar/git/1.7.10/share/git-core/contrib/credential/osxkeychain/git-credential-osxkeychainPetro
It looks like you installed the git-credential-osxkeychain wrapper in the wrong place (did you cp to /usr/bin/git instead of /usr/local/git/bin?) To fix, you'll want to just delete /usr/bin/git; assuming git is still installed in /usr/local/bin it should take over.Steelyard
Your issue would make sense given that the credential helper likely calls back to git, which would result in an infinite exec loop.Steelyard
Thanks a lot! It works now. I was going to try that but I guess I didn't really have the balls to do so without an internet recommendation. It's actually installed to /usr/local/git/bin so I just added that to my PATH.Petro
This worked for me and I reinstalled from brew so it had the osxkeychain already. Maybe you should add the commentary resolution to the answer? Thanks!Dibranchiate
Hehe, I had this problem and it turned out that I copied osxkeychain to /usr/local/git/bin/git rather than /usr/local/git/bin/. D'oh!Cogen
H
5

To fix this I reinstalled git from http://git-scm.com/download/mac and then added /usr/local/git/bin to the top of the file /etc/paths

Hepplewhite answered 6/11, 2012 at 12:0 Comment(1)
Never thought of that. Nice work. Worked. mv /usr/bin/git /usr/bin/git_old ln -s /usr/local/git/bin/git /usr/bin/gitConduce
S
4

Try "git" status (with the quotes). If that works, you've aliased git to something else (probably alias git="git credential-osxkeychain"), and you should look in ~.profile to see if you can remove the alias.

(See the attached commentary for the debugging steps and eventual resolution).

Steelyard answered 27/9, 2012 at 2:44 Comment(10)
I thought it was \ that made it go around aliases. I tried both regardless, neither worked. I also looked in .bash_profile, .bashrc and .gitconfigPetro
\ works too; I'm just used to "...". Did you perchance replace git with some sort of wrapper? What does which git produce?Steelyard
just edited my post to say which git returns /usr/bin/gitPetro
less /usr/bin/git produces binary gibberish? Maybe use Instruments.app or dtrace to figure out what this apparently-modified git is doing?Steelyard
yeah, binary gibberish indeed. actually...some of it is legible for whatever reason. and it says something like /usr/local/share/git-core/contrib/credential/osxkeychain or /usr/local/Cellar/git/1.7.10/share/git-core/contrib/credential/osxkeychain/git-credential-osxkeychainPetro
It looks like you installed the git-credential-osxkeychain wrapper in the wrong place (did you cp to /usr/bin/git instead of /usr/local/git/bin?) To fix, you'll want to just delete /usr/bin/git; assuming git is still installed in /usr/local/bin it should take over.Steelyard
Your issue would make sense given that the credential helper likely calls back to git, which would result in an infinite exec loop.Steelyard
Thanks a lot! It works now. I was going to try that but I guess I didn't really have the balls to do so without an internet recommendation. It's actually installed to /usr/local/git/bin so I just added that to my PATH.Petro
This worked for me and I reinstalled from brew so it had the osxkeychain already. Maybe you should add the commentary resolution to the answer? Thanks!Dibranchiate
Hehe, I had this problem and it turned out that I copied osxkeychain to /usr/local/git/bin/git rather than /usr/local/git/bin/. D'oh!Cogen
E
0

As nneonneo said above, the reason is that files - git-credential-osxkeychain and git - are installed on wrong path (path, which is not default in /etc/paths, which is not on the first line in /etc/paths). Answers above didn't work for me. What exactly I tried : 1) change order of lines in file /etc/paths, but file /etc/paths is not available for changing on Mavericks 2) delete /usr/bin/git - this also didn't help me 3) mv /usr/bin/git /usr/bin/git_old ln -s /usr/local/git/bin/git /usr/bin/git also didn't. So I decided to describe my way. I manually take files - git-credential-osxkeychain and git from /usr/local/git/bin and put in /usr/bin/git (cause /usr/bin/git - is the first path in /etc/paths). To get the path like /etc/paths in finder, just push Command+Shift+G and put path.

Exponible answered 10/7, 2015 at 0:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.