在云服务器上安装部署git
-
用命令进行安装Git
yum install git
-
查看Git版本
git version
-
对Git进行全局设置
git config --global user.name "你的git名" git config --global user.email "你的git邮箱"
-
Git的授权证书是基于公钥和私钥的证书体系,所以需要证书体系
ssh-keygen -t rsa -C "你的git邮箱"
-
切换到ssh目录下
cd ~/.ssh/
-
查看生成的公钥,私钥证书
ls 或者 dir
-
其中id_rsa 是私钥,id_rsa.pub表示公钥,这里需要在git中用到
在guihub中配置
-
登录github
-
点击头像,选择Settings
-
然后点击SSH and GPG Keys
-
选择新建SSH Key:New SSH Key
-
然后填写SSH Key数据。Title是名字(随便写),Key是我们在上边说的的公钥id_rsa.pub。
-
在云服务器,我们在ssh的目录下,输入命令,获取到公钥
cat id_rsa.pub
-
将获取到的公钥放在github的Key中。
-
检查是否连接到github库
ssh git@github.com
-
发现有Hi 你的github名称! You’ve successfully 说明成功了。