目录
[centos 源的配置](#centos 源的配置)
3、git是本地仓库,linux系统中一般会自带git,如果没有,使用yum进行下载
[6、生成本地秘钥ssh key](#6、生成本地秘钥ssh key)
[7、在github中添加密钥ssh key](#7、在github中添加密钥ssh key)
此时需要你去到github你所创建的项目里,找到你的shh链接
1、创建一台虚拟机
centos 源的配置
备份源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
修改源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
重新加载缓存
yum makecache
安装软件
yum -y install zip unzip vim wget httpd lsof net-tools at cronie openssh* ntp gdisk
配置epel
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
2、关闭防火墙和selinux
关闭防火墙
systemctl stop firewalld
临时关闭SELinux
setenforce 0
永久关闭SELinux:编辑SELinux的配置文件
vim /etc/selinux/config
配置文件的修改内容

disabled 关闭 enable 开启
3、git是本地仓库,linux系统中一般会自带git,如果没有,使用yum进行下载
yum install git -y
4、GitHub注册
在官网安装提示进行注册即可,注册登录之后开始我们的项目创建

这是登录之后的界面
5、在github上创建项目



创建完成后会直接进入你所创建的项目里
6、生成本地秘钥ssh key
ssh-keygen -t rsa
-t rsa 表示加密类型是rsa加密

如何查看密钥,密钥生成之后被保存在当前目录的隐藏文件 .ssh 文件里,会有两个密钥,一个私钥id_rsa,一个公钥id_rsa.pub,我们一般使用公钥
cat .ssh/id_rsa.pub
然后复制 公钥,在github 中添加ssh key
7、在github中添加密钥ssh key



此时密钥已经添加完成
进行认证(但不能远程连接)
ssh -T git@github.com

在本地添加远程仓库用户名
git config --global user.name 'yourname'
在本地添加远程仓库邮箱
git config --global user.email '1111111111@qq.com'
查看配置
git config --list
此时需要你去到github你所创建的项目里,找到你的shh链接

克隆远程仓库,会自动生成一个文件,这个文件就是你的库
git clone git@github.com:Cheng-p-f/cpf1111.git
进入到所生成的文件夹里
初始化仓库
git init
设置远程仓库地址
git remote add origin git@github.com:Cheng-p-f/cpf1111.git
写一个文件尝试上传推送
echo 111111 > 1.sh
提交文件
git add . 文件会暂时被缓存
提交文件的解释说明
git commit -m 'git本地第一次提交1.sh'
往远程仓库推送文件
git push -u origin master
只有当完成这一步,文件才算是被推送到github远程仓库上,此时去github刷新页面即可看到你所创建的文件

8、补充
查看现有的远程仓库
git remote -v
移除github远程仓库
先进入想要移除的仓库所在文件里
git remote remove origin