MacBook OSX10.6下 git 的安装

以下方法转自官网:http://help.github.com/mac-git-installation/

Installing git (OSX)

There are a number of methods to install git on OSX. This guide details the most common methods, in order of ease of install.

After you have completed installation you will need to generate an SSH keypair and set your local git config.

Pre-compiled Installer

Download and run git-osx-installer

Homebrew

  1. Install Homebrew if you haven’t already done so.
  2. Install Git (You may want to include Subversion support if you want to import SVN repositories. Snow Leopard already contains a copy of SVN)
$ brew install git
==> Downloading http://kernel.org/pub/software/scm/git/git-1.6.5.7.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/git/1.6.5.7
==> make install
==> Downloading http://kernel.org/pub/software/scm/git/git-manpages-1.6.5.7.tar.bz2
######################################################################## 100.0%
/usr/local/Cellar/git/1.6.5.7: 383 files, 16M, built in 74 seconds

MacPorts

  1. Install MacPorts if you haven’t already done so.
  2. Make sure your ports are up to date.
  3. Install Git (You may want to include Subversion support if you want to import SVN repositories)
$ sudo port selfupdate

MacPorts base version 1.600 installed
Downloaded MacPorts base version 1.600

The MacPorts installation is not outdated and so was not updated
selfupdate done!

$ sudo port install git-core +svn
--->  Installing curl 7.18.2_0
--->  Activating curl 7.18.2_0
--->  Installing openssh 5.0p1_0+darwin_9
--->  Activating openssh 5.0p1_0+darwin_9
--->  Installing p5-error 0.17012_0
--->  Activating p5-error 0.17012_0
--->  Installing popt 1.13_0
--->  Activating popt 1.13_0
--->  Installing rsync 3.0.2_0
--->  Activating rsync 3.0.2_0
--->  Installing git-core 1.5.5.3_0+doc
--->  Activating git-core 1.5.5.3_0+doc

Compiling git manually

See this guide.

自己心得:

在Git for OS X下使用git本来应该很简单,github guide上介绍了3种在osx上使用git的方法:

  1. 下载并安装git-osx-installer
  2. 使用macports安装git
  3. 从git的原代码安装

不过第一种方法只支持leopard,如果你用的还是tiger的话就要考虑后面的方法了,按照完之后,要重新打开一个终端才能使用git

第二种方法在使用macports安装git的时候居然提示缺少perl的运行环境什么的错误,第三种方法也需要下载mac下的编译工具,实在是太麻烦了,于是还是借助google搜索了已经在tiger上编译好的git安装包git-1.5.4.3-1.mpkg,安装完成后最好在终端运行环境(.bashrc)中加入git的地址以便下次直接可以运行git的命令:

export PATH=$PATH:/usr/local/bin
export MANPATH=`manpath`:/usr/local/man

转载于:https://www.cnblogs.com/shanghaif/archive/2010/07/14/1776998.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值