github应用
四、github和gitlab
1、github
1)认识github
github的核心组件是git版本托管服务
全球最大的软件仓库
github每天用户活跃量超过200w
2)git的特点
开源
支持图形化界面
支持公有仓库和私有仓库
2、公有仓库和私有仓库区别
1)公有仓库
所有用户都可以访问
一般开源使用
2)私有仓库
经过身份验证可以使用
一般企业用户注册使用
私有仓库收费
3、配置github
注册一个github账户并登录:
创建仓库:test仓库
1、配置git连接github
1)添加NAT网卡,保证能上网
ping www.baidu.com
2)生成git服务器密钥对
[root@centos01 ~]# ssh-keygen -t rsa
[root@centos01 ~]# cat .ssh/id_rsa.pub (添加ssh密钥key时复制)
3)添加ssh密钥
名字:centos01
key:[root@centos01 ~]# cat .ssh/id_rsa.pub (复制里面的内容)
4)连接远程仓库
[root@centos01 git_data]# git remote add origin git@github.com:f123t123/test.git
5)提交连接到远程仓库
[root@centos01 git_data]# git push -u origin master
6)在工作区创建a.txt和b.txt文件,并提交到git仓库
[root@centos01 git_data]# touch a.txt
[root@centos01 git_data]# touch b.txt
提交到暂存区:
[root@centos01 git_data]# git add .
提交到仓库:
[root@centos01 git_data]# git commit . -m 'new a.txt b.txt'
提交连接到远程仓库:
[root@centos01 git_data]# git push -u origin master
登录github账户,进入到test仓库进程查看:
看看是否有(a.txt和b.txt文件)
2、配linux客户端去github公共仓库下载数据
给linux客户端添加NAT网卡,能上网:
ping www.baidu.com
1)克隆github仓库到本地
首先:
生成密钥对:
[root@centos02 ~]# ssh-keygen -t rsa
[root@centos02 ~]# cat .ssh/id_rsa.pub
克隆github仓库到本地:
[root@centos02 ~]# git clone git@github.com:f123t123/test.git
linux客户端本地会出现test目录
2)配置客户端去github下载数据到本地
在工作区创建ceshi.txt文件:
[root@centos01 git_data]# touch ceshi.txt
提交到暂存区:
[root@centos01 git_data]# git add .
提交到仓库:
[root@centos01 git_data]# git commit ceshi.txt -m 'new ceshi.txt'
提交连接到远程仓库:
[root@centos01 git_data]# git push -u origin master
下载数据到本地:
[root@centos02 test]# git pull
linux客户端本地会有ceshi.txt文件

浙公网安备 33010602011771号