Install Git--MacOs X
2016-04-19 22:41
239 查看
学习、应用Git第一步自然是要在你的系统中安装它,现在MacOs X、Linux、Windows中均可以安装Git。下面介绍在MacOs X中Git的安装。
有三种方法:
第一种:安装homebrew,然后通过homebrew安装Git,具体方法请参考homebrew的文档:http://brew.sh/。
第二种:推荐用此方法安装,
下载: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
$ ls
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/yyq/.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 galia_cc@yeah.net
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 Alvinn-hit! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
出现上述提示信息说明连接成功(github并不提供shell登陆但已经连接成功)
6.设置个人信息
$ git config --global user.name "于库里"
$ git config --global user.email galia_cc@yeah.net
第三种方法:直接从AppStore安装Xcode,Xcode集成了Git,不过默认没有安装,你需要运行Xcode,选择菜单“Xcode”->“Preferences”,在弹出窗口中找到“Downloads”,选择“Command Line Tools”,点“Install”就可以完成安装了。
有三种方法:
第一种:安装homebrew,然后通过homebrew安装Git,具体方法请参考homebrew的文档:http://brew.sh/。
第二种:推荐用此方法安装,
下载: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
$ ls
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/yyq/.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 galia_cc@yeah.net
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 Alvinn-hit! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
出现上述提示信息说明连接成功(github并不提供shell登陆但已经连接成功)
6.设置个人信息
$ git config --global user.name "于库里"
$ git config --global user.email galia_cc@yeah.net
第三种方法:直接从AppStore安装Xcode,Xcode集成了Git,不过默认没有安装,你需要运行Xcode,选择菜单“Xcode”->“Preferences”,在弹出窗口中找到“Downloads”,选择“Command Line Tools”,点“Install”就可以完成安装了。
相关文章推荐
- RPC failed; result=22, HTTP code = 411
- git更新已經刪除的文件
- 提取Git每次提交后Commit的文件
- GIT迁移服务器
- 分布式版本管理git入门指南使用资料汇总及文章推荐
- git终极指南:在实际开发中的应用
- Git远程操作详解
- 25个 Git 进阶技巧(翻译)
- 详解版本控制利器Git,SVN的异同以及适用范围
- Ruby实现的删除已经合并的git分支脚本分享
- 在 Shell 提示符中显示 Git 分支名称的方法
- Git使用基础篇(一些常用命令和原理)
- git fork同步是什么意思?
- Git使用小坑 Out of memory错误的解决方法
- Python的高级Git库 Gittle
- 使用GIT进行源码管理――GUI客户端小结
- 使用git代替FTP部署代码到服务器的例子
- linux系统安装git及git常用命令
- 分享下自己总结的Git常用命令
- Git 常用命令速查表(图文+表格)