Aug 8, 2012 - mac    No Comments

Recovery My Git Library

Web Sharing 恢复后,就要恢复自己的git库了。但装好mac下的git程序后,发现git命令行是无法正常使用的,看来还是Mountain Lion的问题。

$ git: command not found


在网上查了一下,最快的解决方法就是安装 Xcode Commond Line Tools,
Xcode 去 app store 下载
然后打开Xcode,’command+,’ 按照下图安装Xcode Commond Line Tools

这样git就可以正常使用了。

接下来把原先的code文件夹拷回 ~/Sites 下面,把备份的 .gitconfig 和 .gitignore_global 拷回 ~/ 下面

再打开SourceTree, 添加已有 git 库  /Users/ares/Sites/code

这样,自己的git库就回来了。但又会碰到一个问题,当文件权限改变后,git会认为文件被修改过了,需要你重新提交,(Modified file, mode 100644->100755)

解决方法:

$ cd ~/Sites/code
$ git config --add core.filemode false

同时不要忘记

$ git add -u

如果发现 $ git add -u 不起作用,就删除SourceTree里添加的库,再到code目录下输入

$ git add -A

重新打开SourceTree里添加code库就可以了

最好再导一份代码到:https://bitbucket.org 比较保险

Got anything to say? Go ahead and leave a comment!