git学习——Github关联(2)

一、参考学习链接

1、重点看Github与Git的关联。

http://www.cnblogs.com/schaepher/p/5561193.html#github

2、git的全面详细介绍。

http://www.cnblogs.com/Genesisx/p/5556531.html

3、设置或者取消代理

https://gist.github.com/laispace/666dd7b27e9116faece6

二、Github与Git关联

本地Git和Github的连接。

Step-1:到Github上注册账号,https://github.com。(账户已经申请好)

Step-2:本地配置用户名和邮箱(如果已经设置好,跳过该步)。

git config --global user.name "aijasper"
git config --global user.email "jaspersong@qq.com"

Step-3:生成ssh key,ssh-keygen -t rsa -C "你的邮箱"。

ssh-keygen -t rsa -C "jaspersong@qq.com"

Step-4:复制生成的ssh-key。

将上面一步生成的ssh key复制保存下来。
第一种方式:将生成的ssh key复制到剪贴板,执行命名

clip < ~/.ssh/id_rsa.pub

复制到自己的文本文件中。
第二种方式:.ssh/id_rsa.pub去拷贝生成的ssh key。

Step-5:打开Github,进入Settings。

点击左边的 SSH and GPG keys ,将ssh key粘贴到右边的Key里面。Title随便命名即可。

点击下面的 Add SSH key 就添加成功了。

Step-6:测验是否关联通过。

执行命名:ssh -T git@github.com

   
如果测试不通过,需要设置代理,比如公司网络的代理设置如下:
设置代理:

git config --global http.proxy http://dev-proxy.oa.com:8080

取消代理:
git config --global --unset http.proxy

创建远程仓库并与本地关联

Step-1:创建一个项目。

假如已经成功创建了一个项目。
https://github.com/aijasper/reading。

Step-2:将远程仓库和本地仓库关联起来。

Step-3:其他的运用Git命名push或者pull仓库项目即可。

如果不清楚,可参加文章最开头的链接。

git clone git@github.com:aijasper/reading.git

Step-4:git bash 记住用户名和密码

Git bash 记住用户名和密码,不用每次提交的时候都需要输入密码。
git config --global credential.helper store
设置参见博客:
https://www.cnblogs.com/ballwql/p/3462104.html

posted @ 2017-12-09 13:02  jaspersong  阅读(524)  评论(1编辑  收藏  举报