服务器Gitee配置-git方式
给服务器装上Git并且配置权限,可以访问私有库
1.服务器安装Git
yum install git
注意: 国内可能需要设置阿里的centos yum 源,centos 要使用7以上,不然找不到合适的源,很多软件装不了。
2.服务器生成sshKey
-
1.查看是否安装git
ls -al ~/.ssh
注意: 此时你要尽可能使用root用户,因为Git拉下来的数据可能创建文件等。
-
2.如果安装了git,那么卸载调,不卸载也行,需要那笑id_sub.
rm -rf .ssh
-
3.生成sshKey,这里邮箱最好自定义个能够分辨你服务器名称的邮箱
ssh-keygen -t rsa -C "xxxx@qq.com"
然后一直回车
Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: a3:4f:b8:95:c9:2e:32:2e:e9:d3:87:bd:37:b1:85:d7 yizhuang39@qq.com The key's randomart image is: +--[ RSA 2048]----+ | | | | | | | | | S. . | | +o+o E | | o 11 *= | | + = +*d+ | | ..+.+o+o. | +-----------------+
-
4.提取sshKey
cat /root/.ssh/id_rsa.pub
-
5.加入到gitee的shhKey中,因为我们没有设置密码,那么直接添加就可以了
-
6.恭喜你,现在就可以拉取你当前用户的git仓库了。