I am not new to git but I am newer to github and still a beginner with bash. I was trying to set some config stuff and ending up breaking git on my local machine. Here’s what I did following these instructions on github for password caching.
$ git config --global user.name 'myusername'
$ git config --global user.email 'myemail@email.com'
$ git credential-osxkeychain
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
$ curl -s -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain
$ chmod u+x git-credential-osxkeychain
$ which git
/usr/bin/git
$ sudo mv git-credential-osxkeychain /usr/bin/git
$ git config --global credential.helper osxkeychain
^?^C
After this command git I received no response, just a new line which I eventually ctrl+c’ed out of. Now, whenever I do a git command in any repo, not just this one, the cursor just moves to a new line. I’m unable to push/pull/clone or do use of the commands I normally use.
I’ve tried reinstalling the latest version of git and still have the problem. What should I do?
Update:
I’ve tried unsetting credential.helper and uninstalling and reinstalling git. Still seeing the same behavior. I noticed that if I run just $ git the response is Usage: git credential-osxkeychain <get|store|erase>. At this point, I just want to delete credential-osxkeychain. Still unsuccessful.
As requested, the output of which -a git is:
$ which -a git
/usr/bin/git
/usr/local/git/bin/git
When you ran this command:
You overwrote the existing
gitexecutable with thegit-credential-osxkeychainexecutable. That script is only meant to be run as a sub-command of Git, not standalone.If you use Time Machine, you can try to restore the old
/usr/bin/gitfrom a backup. Otherwise, you’ll need to reinstall Git.Based on the comments below, it appears that
/usr/bin/gitis actually stillgit-credential-osxkeychain, probably because Git installed itself into/usr/localinstead of/usr/bin.If you don’t care about the keychain behavior anymore, you can remove the current
gitexecutable altogether:That may cause Git to start working for you immediately if
/usr/local/git/binis in your path. Or you could simply move it to/usr/local/git/bin/git-credential-osxkeychain:which (again, assuming your path is correct) should allow you to use it as a credential helper like you originally wanted.