zoukankan      html  css  js  c++  java
  • Mac OS X Git安装教程

    下载:http://code.google.com/p/git-osx-installer/

    下载最新的PGK文件。

    图形化OpeninGitGui:

    http://code.google.com/p/git-osx-installer上也提供了一个Git的图形化客户端:OpenInGitGui,可以从这里获得,OpenInGitGui十分小巧,下载解压后也只有16K,OpenInGitGui不用安装,双击即可使用,OpenInGitGui刚启动时,会记录打开过的资源库。

    github使用SSH链接,需要设置SSH

    1.检查SSH key

         cd ~/.ssh

    2.备份已有的key,(如果有的话)

         mkdir key_backup

         mv id_rsa* key_backup

    3.生成SSH key

    $ ssh-keygen -t rsa -C jonezhang86@gmail.com

    Generating public/private rsa key pair.

    Enter file in which to save the key (/Users/jiangbo/.ssh/id_rsa):

    Enter passphrase (empty for no passphrase):

    Enter same passphrase again:

    Your identification has been saved in yes.

    Your public key has been saved in id_rsa.pub.

    The key fingerprint is:

    fb:c4:b0:e0:47:fd:be:e0:fb:ea:73:ef:a8:29:d5:22 jonezhang86@gmail.com

    The key's randomart image is:

    +--[ RSA 2048]----+

    |                 |

    |                 |

    |                 |

    |         .       |

    |      . S ..     |

    |     . oE=o..    |

    |      . +o+..    |

    |       ..+.+..   |

    |         oOB=+o  |

    +-----------------+

    4.将SSH key添加到GitHub

    登录到GitHub页面,Account Settings->SSH Public Keys->Add another key

    将生成的key(id_rsa.pub文件)内容copy到输入框中,save。

    5.测试链接

    $ ssh git@github.com

    The authenticity of host 'github.com (207.97.227.239)' can't be established.

    RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.

    Are you sure you want to continue connecting (yes/no)? yes

    PTY allocation request failed on channel 0

    Hi Jone Zhang! You've successfully authenticated, but GitHub does not provide shell access.

             Connection to github.com closed.

    出现上述提示信息说明连接成功(github并不提供shell登陆但已经连接成功)

    三、设置个人信息

    $ git config --global user.name "Jone Zhang"

    $ git config --global user.email jonezhang86@gmail.com

    补充内容:

    Mac
    在 Mac 上安装 Git 有多种途径:最简单的方法就是使用  Git OS X Installer。打开 Google Code 上的 git-osx- installer 页面,下载最新的安装包。现在最新的是 Git 1.7.5。挂载 dmg 镜像安装 Git。

    • 如果你想使用 Git GUI,那么就运行 dmg 镜像中的脚本来安装。
    • 如果你想使用类似于 Homebrew 或者 MacPorts 的包管理来安装,也是非常简单的。

    Homebrew

    $ sudo brew install git

    MacPorts

    $ sudo port selfupdate
    $ sudo port install git-core

    ( sudo 是已 root 用户权限运行命令;通常安装软件是需要。如果使用 sudo,命令行会要求输入用户密码。)

    如果想要更深入的体验 Git,那么就从源代码安装吧。首先,需要安装 Apple Developer Tools – Xcode。可以在  http://developer.apple.com/mac/ 下载。
    我们将 Git 安装在 /usr/local 目录下,确保 Terminal 可以在 $PATH 环境变量中找到。 检查 /usr/ local/bin 路径 ( bin 代表 binary,编译的 Git 报存在子目录中)。 如果不再,打开 .profile 添加到最后。

    export PATH=”/usr/local/bin:$PATH

    保存关闭 .profile 文件后,重启 Terminal。运行 echo $PATH 应该看到 /usr/local/bin 在 $PATH 环境变量中。
    现在我们可以开始安装 Git 了,如果还不是很熟悉命令行,可以使用之前的方法安装。如果没有问题,开始吧。
    下载并解压 Git 源代码:

    $ curl -O http://kernel.org/pub/software/scm/git/git-1.7.5.tar.bz2
    $ tar xzvf git-1.7.5

    打开目录,编译 Git:

    $ cd git-1.7.5
    $ ./configure --prefix=/usr/local
    $ make
    $ make install

    完成!现在可以删除这个目录的了。

    $ cd ..
    $ rm git-1.7.5
    $ rm git-1.5.1.tar.bz2

    应该看到 Git 已经成功安装,查看安装位置:

    $ which git

    应该得到 /usr/local/bin/git。如果正确,就说明已经成功从源代码安装 Git!

    iCC Develop Center
  • 相关阅读:
    Power of Cryptography
    Radar Installation
    Emag eht htiw Em Pleh
    Help Me with the Game
    89. Gray Code
    87. Scramble String
    86. Partition List
    85. Maximal Rectangle
    84. Largest Rectangle in Histogram
    82. Remove Duplicates from Sorted List II
  • 原文地址:https://www.cnblogs.com/ccdev/p/2682098.html
Copyright © 2011-2022 走看看