https://segmentfault.com/a/1190000002645623
2016-06-02 11:59
537 查看
1、设置Git的user name和email:(如果是第一次的话)
$ git config --global user.name "humingx" $ git config --global user.email "humingx@yeah.net"
2、生成密钥
$ ssh-keygen -t rsa -C "humingx@yeah.net"
连续3个回车。如果不需要密码的话。
最后得到了两个文件:
id_rsa和
id_rsa.pub。
如果不是第一次,就选择
overwrite.
3、添加密钥到ssh-agent
确保 ssh-agent 是可用的。ssh-agent是一种控制用来保存公钥身份验证所使用的私钥的程序,其实ssh-agent就是一个密钥管理器,运行ssh-agent以后,使用ssh-add将私钥交给ssh-agent保管,其他程序需要身份验证的时候可以将验证申请交给ssh-agent来完成整个认证过程。# start the ssh-agent in the background eval "$(ssh-agent -s)" Agent pid 59566
添加生成的 SSH key 到 ssh-agent。
$ ssh-add ~/.ssh/id_rsa
4、登陆Github, 添加 ssh 。
把id_rsa.pub文件里的内容复制到这里
5、测试:
$ ssh -T 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
Hi humingx! You've successfully authenticated, but GitHub does not provide shell access.
如果看到
Hi后面是你的用户名,就说明成功了。
6、修改.git
文件夹下config
中的url
。
修改前[remote "origin"] url = https://github.com/humingx/humingx.github.io.git fetch = +refs/heads/*:refs/remotes/origin/*
修改后
[remote "origin"] url = git@github.com:humingx/humingx.github.io.git fetch = +refs/heads/*:refs/remotes/origin/*
7、发布
2015年04月02日发布
相关文章推荐
- 一个关于if else容易迷惑的问题
- Android Native 绘图方法
- RPC failed; result=22, HTTP code = 411
- PHP5.2.*防止Hash冲突拒绝服务攻击的Patch
- 深入理解PHP之匿名函数
- git更新已經刪除的文件
- JSP/PHP基于Ajax的分页功能实现
- 关于PHP通过PDO用中文条件查询MySQL的问题。
- 提取Git每次提交后Commit的文件
- GIT迁移服务器
- 什么是设计模式
- 分布式版本管理git入门指南使用资料汇总及文章推荐
- PHP数据库长连接mysql_pconnect的细节
- Php Installing An Expansion
- git终极指南:在实际开发中的应用
- rem : web app适配的秘密武器
- jquery高级应用之Deferred对象
- php7 读取php.ini[4]
- C#中struct和class的区别详解