Перейти к содержимому

Почему Git не может обновиться?

0

Это фактическое копирование / вставка из моей оболочки:

machine:~ me$ brew install git ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.2.1.mountain_lion.bottle.tar.gz ######################################################################## 100.0% ==> Pouring git-2.2.1.mountain_lion.bottle.tar.gz ==> Caveats The OS X keychain credential helper has been installed to: /usr/local/bin/git-credential-osxkeychain  The "contrib" directory has been installed to: /usr/local/share/git-core/contrib  Bash completion has been installed to: /usr/local/etc/bash_completion.d  zsh completion has been installed to: /usr/local/share/zsh/site-functions ==> Summary /usr/local/Cellar/git/2.2.1: 1356 files, 32M machine:~ me$  machine:~ me$ git --version git version 1.7.10.2 (Apple Git-33) machine:~ me$  

Я могу закрыть Терминал и открыть его снова, но отображается та же версия Git.

Бег which gitвозвращается /usr/bin/git. Если я перемещаю этот двоичный файл в /usr/bin/git, а затем git --versionснова запускаю, он возвращается git version 2.2.1, но почему установка нового Git не заменяет старый?

409 просмотров
orokusaki спросил 11 лет назад
O 589

2 ответа

2

Дай export PATH="/usr/local/bin:$PATH"попробовать. Если это работает, добавьте его в ваш файл .bashrc

Prashant ответил 11 лет назад
P 638
1
Принятый ответ

I'm no Mac/homebrew expert, but typically what happens is that when you install, it simply unpacks git to it's own, version specific, directory. /usr/bin/git is likely a symbolic link to the actual git binary in said version specific directory. All you would need to do in that case is unlink /usr/bin/git and recreate the link to the newer directory. If I were to guess at the command, not knowing your directory tree, it would be something like this:

unlink /usr/bin/git ln -s /usr/local/Cellar/git/2.2.1/bin/git /usr/bin/git 
Foosh ответил 11 лет назад
F 1 116