github私有仓库搭建

安装Git

1,使用yum安装git
[root@centos01 ~]# yum -y install git
2,设置git账户
[root@centos01 ~]# git config --global user.name "xiaoli"
3,设置git邮箱
[root@centos01 ~]# git config --global user.email "[email protected]"
[root@centos01 ~]# git config --global color.ui true
4,查看git全局配置
[root@centos01 ~]# git config --list 
5,查看git生成的配置文件
[root@centos01 ~]# cat .gitconfig 

搭建私有仓库

添加ssh密钥步骤

1,生成ssh密钥
[root@centos01 ~]# ssh-keygen -t rsa
2,查看私钥
[root@centos04 ~]# cat .ssh/id_rsa.pub 
3,复制到GitHub

搭建仓库步骤

1,创建git仓库根目录
[root@centos01 ~]# mkdir git_data
2,初始化git仓库
[root@centos01 ~]# cd git_data/
[root@centos01 git_data]# git init
3,创建测试文件
[root@centos01 git_data]# touch 1.txt
查看git状态
[root@centos01 git_data]# git status 

github私有仓库搭建_第1张图片

4,把测试文件从工作目录提交到暂存区域
[root@centos01 git_data]# git add 1.txt
查看git状态
[root@centos01 git_data]# git status

github私有仓库搭建_第2张图片

6,关联公网远程仓库
[root@centos01 git_data]# git remote add origin 加你的仓库访问连接
7,把测试文件从本地仓库上传到公网仓库,需要输入GitHub的用户名和密码
[root@centos01 git_data]# git push -u origin master

github私有仓库搭建_第3张图片
8,登录GitHub查看上传的文件
github私有仓库搭建_第4张图片

9,git客户端文件下载
[root@centos02 ~]# git clone 仓库链接
10,清除git缓存
[root@centos01 ~]# git rm -r --cached . 

GitHub使用

创建仓库
github私有仓库搭建_第5张图片
github私有仓库搭建_第6张图片
删除仓库
github私有仓库搭建_第7张图片
github私有仓库搭建_第8张图片
添加ssh密钥
github私有仓库搭建_第9张图片
github私有仓库搭建_第10张图片
添加后保存github私有仓库搭建_第11张图片

你可能感兴趣的:(git,ssh,github)