如何使用Macports安装git?

如何使用Macports安装git?,git,installation,macports,Git,Installation,Macports,Git过去在我的Mac OS X上工作得很好。今天我发现它不工作: $ git -bash: git: command not found 我以前安装过Macports。现在,如果我再试一次,会发生以下情况: $ sudo port install git-core Portfile changed since last build; discarding previous state. ---> Computing dependencies for git-core --->

Git过去在我的Mac OS X上工作得很好。今天我发现它不工作:

$ git
-bash: git: command not found
我以前安装过Macports。现在,如果我再试一次,会发生以下情况:

$ sudo port install git-core
Portfile changed since last build; discarding previous state.
--->  Computing dependencies for git-core
--->  Fetching archive for git-core
--->  Attempting to fetch git-core-1.8.0.2_0+credential_osxkeychain+doc+pcre+python27.darwin_10.x86_64.tbz2 from http://packages.macports.org/git-core
--->  Attempting to fetch git-core-1.8.0.2_0+credential_osxkeychain+doc+pcre+python27.darwin_10.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/git-core
--->  Attempting to fetch git-core-1.8.0.2_0+credential_osxkeychain+doc+pcre+python27.darwin_10.x86_64.tbz2 from http://lil.fr.packages.macports.org/git-core
--->  Fetching distfiles for git-core
--->  Attempting to fetch git-1.8.0.2.tar.gz from http://ykf.ca.distfiles.macports.org/MacPorts/mpdistfiles/git-core
--->  Attempting to fetch git-manpages-1.8.0.2.tar.gz from http://ykf.ca.distfiles.macports.org/MacPorts/mpdistfiles/git-core
--->  Attempting to fetch git-htmldocs-1.8.0.2.tar.gz from http://ykf.ca.distfiles.macports.org/MacPorts/mpdistfiles/git-core
--->  Verifying checksum(s) for git-core
--->  Extracting git-core
--->  Applying patches to git-core
--->  Configuring git-core
--->  Building git-core
--->  Staging git-core into destroot
--->  Installing git-core @1.8.0.2_0+credential_osxkeychain+doc+pcre+python27
--->  Activating git-core @1.8.0.2_0+credential_osxkeychain+doc+pcre+python27
Error: org.macports.activate for port git-core returned: Image error: /opt/local/libexec/git-core/git-subtree already exists and does not belong to a registered port.  Unable to activate port git-core. Use 'port -f activate git-core' to force the activation.
Please see the log file for port git-core for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_git-core/git-core/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port git-core failed
21:51 foouser@barhost:~$ sudo port -f activate git-core
--->  The following versions of git-core are currently installed:
--->      git-core @1.7.7.2_0+doc+pcre+python27
--->      git-core @1.7.7.4_0+doc+pcre+python27
--->      git-core @1.7.9_0+doc+pcre+python27
--->      git-core @1.7.9.2_0+doc+pcre+python27
--->      git-core @1.7.9.2_1+credential_osxkeychain+doc+pcre+python27
--->      git-core @1.7.9.4_0+credential_osxkeychain+doc+pcre+python27
--->      git-core @1.7.10_0+credential_osxkeychain+doc+pcre+python27
--->      git-core @1.7.11.3_0+credential_osxkeychain+doc+pcre+python27
--->      git-core @1.7.11.5_0+credential_osxkeychain+doc+pcre+python27
--->      git-core @1.7.12.2_0+credential_osxkeychain+doc+pcre+python27
--->      git-core @1.8.0.1_0+credential_osxkeychain+doc+pcre+python27
--->      git-core @1.8.0.2_0+credential_osxkeychain+doc+pcre+python27
Error: port activate failed: Registry error: Please specify the full version as recorded in the port registry.

它仍然不起作用。我应该如何恢复我心爱的git?

问题是您的系统上安装了多个
git核心。您需要更精确地添加的内容。否则,请激活特定版本

例如,您可以执行以下操作:

sudo port install git-core @1.7.11.3_0+credential_osxkeychain+doc+pcre+python27
选择带有上述变体的版本1.7.11.3_0。 或通过执行以下操作来更新上一版本:

sudo port install git-core @1.8.0.2_0+credential_osxkeychain+doc+pcre+python27

你为什么不按照错误告诉你的去做,并指定一个完整的版本?(并卸载已安装的~10个旧版本)如何一起卸载旧版本?请看这里:这将帮助您升级git版本: