Git 请教如何升级 git 版本

ying39 · 2014年04月04日 · 最后由 hozaka 回复于 2014年04月05日 · 18823 次阅读

开始学习git,看了下版本很旧,是1.7的,所以开始各种折腾,发现无论如何搞不定,特此发贴请教:

1.官方下载mac的dmg安装文件,安装完无效 2.通过brew install git,之后再运行brew git update提示如下,顺带请教量问题: (1)是否一定要升级整个Xcode,太大了占空间,只升级命令行工具是否可行。 (2)如何卸载MacPorts,是否是因为这个冲突引起版本无法更新的。 Warning: Your Xcode (5.0.2) is outdated Please update to Xcode 5.1. Xcode can be updated from the App Store. Warning: It appears you have MacPorts or Fink installed. Software installed with other package managers causes known problems for Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again. Warning: git-1.9.1 already installed, it's just not linked

3.因为提示not linked,所以执行brew link git,提示: Warning: Could not link git. Unlinking... Error: Could not symlink file: /usr/local/Cellar/git/1.9.1/bin/git-upload-pack Target /usr/local/bin/git-upload-pack already exists as a symlink to /Applications/GitHub.app/Contents/Resources/git/bin/git-upload-pack. If this file is from another formula, you may need to brew unlink it. Otherwise, you may want to delete it. To force the link and overwrite all other conflicting files, do: brew link --overwrite formula_name

To list all files that would be deleted: brew link --overwrite --dry-run formula_name

共收到 2 条回复

先升级你的 homebrew 版本,再给升级其他软件

直接

brew link --overwrite git

应该就可以了,不行就

sudo rm /usr/local/bin/git /usr/local/bin/git-*
brew link git
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册