1.准备CentOS7
(1)下载VMware Workstation
https://pan.baidu.com/s/1miFU8mk
(2)下载CentOS7镜像
https://mirrors.aliyun.com/centos/
(3)安装CentOS7系统
http://blog.51cto.com/fengyunshan911/1952566
2.安装git
# yum install git -y
3.注册github账号
https://github.com/
4.github中新建项目
5.git工具拉取代码到本地
(1)生成公钥对,将公钥填写到github中
输入完ssh-keygen一直按回车结束
查看公钥
填写到github
(2)git拉取代码
[root@localhost ~]# git config --global user.name "fengxiaoqing"
[root@localhost ~]# git config --global user.email "fy88fy@163.com"
[root@localhost ~]# git clone git@github.com:fy88fy/studypy.git
正克隆到 'studypy'...
The authenticity of host 'github.com (52.74.223.119)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
RSA key fingerprint is MD5: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
Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts.
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
接收对象中: 100% (3/3), done.
[root@localhost ~]# ls
anaconda-ks.cfg studypy
[root@localhost ~]# cd studypy/
[root@localhost studypy]# ls
README.md
6.创建新文件push到github中
[root@localhost studypy]# touch test.md
[root@localhost studypy]# ls
README.md test.md
[root@localhost studypy]# git add test.md
[root@localhost studypy]# git commit -m "add test.md"
[dev 794d8d5] add test.md
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test.md
[root@localhost studypy]# git push origin dev
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 269 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:fy88fy/studypy.git
22c5482..794d8d5 dev -> dev
[root@localhost studypy]#
我提交到的是dev分支,没有dev分支可以直接提交到master上命令是git push origin master
到github中查看: