git on Mac OS X Lion

荒凉一梦 提交于 2020-07-02 03:22:43

问题


I just upgraded my mac to LION, and now git is gone:

$ git
-bash: git: command not found

Any ideas on how to get git back?


回答1:


The default install location is /usr/local so add this to your ~/.bash_profile

export PATH=$PATH:/usr/local/git/bin/

then run source ~/.bash_profile in Terminal




回答2:


If you do not want to install XCode and/or ports/fink/homebrew, you could always use the standalone installer: http://code.google.com/p/git-osx-installer/




回答3:


There are a couple of points to this answer.

Firstly, you don't need to install Xcode. The Git installer works perfectly well. However, if you want to use Git from within Xcode - it expects to find an installation under /usr/local/bin. If you have your own Git installed elsewhere - I've got a script that fixes this.

Second is to do with the path. My Git path used to be kept under /etc/paths.d/ However, a Lion install overwrites the contents of this folder and the /etc/paths file as well. That's what happened to me and I got the same error. Recreating the path file fixed the problem.




回答4:


you have to find where git is and then add the folder to the PATH variables in .bash_profile.

Using terminal:

1) search for git:

sudo find / -name git

2) edit the .bash_profile add

PATH="<DIRECTORY OF GIT>:$PATH"

Git is back :-)

Anyway i suggest you to install git using macports, in this way you can easilly upgrade your git to the newest release

Hope this helps




回答5:


It's part of Xcode. You'll need to reinstall the developer tools.




回答6:


You can always use port



来源:https://stackoverflow.com/questions/6810059/git-on-mac-os-x-lion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!