'all of my git commands do nothing
I'm trying to set up git on Mac OS X. I ran the install and everything seemed to be fine, but now it's acting very strangely. Typing any command that begins with git does nothing except show me an empty line in my shell; pressing Enter a second time then just gives me a new command prompt. Here's what I mean:
wireless-224-128:~ $ git init
wireless-224-128:~ $ git config --global user.name "My Name"
wireless-224-128:~ $ git config --global user.email "[email protected]"
wireless-224-128:~ $ cd first_git/
wireless-224-128:first_git $ git init
wireless-224-128:first_git $
All of those empty lines are places where the program just sits there doing nothing (at least, nothing that I can see). Pressing Enter a second time sends me back to the prompt as I said.
What's going on here? By the way, the behavior seemed to change after I installed the git osx keychain -- well, the only git commands I had run prior to setting that up were the calls to configure my username and email, but they seemed to work. I'm not sure if the keychain has messed up my system in some way. Any ideas?
UPDATE:
I've gone a bit forwards and backwards. I attempted to remove and reinstall git. Now it seems that I have a working version of git, in that if I run /usr/local/git/bin/git --version it responds correctly. However, if I type git --version, it tells me -bash: /usr/bin/git: No such file or directory. However, looking in /usr/bin/git, I DO in fact have a file named git, and several other files that start with git. What the hell?
FURTHER UPDATE:
I was able to get it to work (at least, as far as I can tell). What I did is detailed in my answer below, and is probably groan-worthy to seasoned unix pros. Thanks for all the help.
Solution 1:[1]
Alright, I'm not sure exactly what happened, but I think I probably accidentally overwrote a file or otherwise corrupted my installation. What ended up fixing it was running the uninstall.h script included with the package, deleting all of the git-related binaries in /usr/bin, reinstalling the package, and then quitting and restarting the terminal. Without doing the last step, the terminal would keep looking for files in /usr/bin, even after reinstalling.
Thanks for all of your help guys. As it turns out, I think it just came down to simple user error/unix-related silliness. :)
Solution 2:[2]
perhaps you have git-credential-osxkeychainin installed, and git is actually aliased:
check where git is installed which git
make sure that git-credential-osxkeychain is installed in /usr/local/bin - the same place that git should be installed. If it is installed in /usr/local/git/bin - you can just add that to your PATH and everything should work.
Some other trouble-shooting tips:
try "git" init with the quotes, if it works, then you have an alias that is calling something else and not returning. Take a look at your ~/.profile, look for something like:
alias git="git credential-osxkeychain" - most likely what you have.
You could remove the alias to fix.
Solution 3:[3]
You should check git is installed by typing into the terminal
which git
it should (if it has been installed correctly) display something like:
? wwwArt git:(development) ? which git
/usr/bin/git
If this does show something similar then git is installed and you will have to now check that you have the latest version
? wwwArt git:(development) ? git --version
git version 1.8.0 (Apple Git-33)
now if you cannot execute or you have an old version then i would suggest removing the git installation using the install path on your system (found from which git, or by searching using spotlight)
rm -rf /path/to/git
rm /etc/paths.d/git
rm /etc/manpaths.d/git
and install a fresh copy from our friends over at git-scm
http://git-scm.com/download/mac (see edit)
I hope this helps you towards getting git working - it is the start of something great in your career.
edit:
As suggested by @Michael homebrew is a package manager which allows you to install / uninstall very easily using brews cellar (where it stores applications) and this is nicer front end and wont harm your system from a bad install as you can brew uninstall, you can find the link below
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | limp_chimp |
| Solution 2 | Michael |
| Solution 3 | Glorfindel |
