githup
centos7.2_x64
在需要创建本地版本库的linux服务器上用ssh-keygen命令生成公钥私钥对,文件默认保存在/root/.ssh/id_rsa中
登录githup,点击右上角“Setting”,找到“SSH and GPG keys”,点击右上角的“New SSSH key”
cat /root/.ssh/id_rsa.pub将秘钥内容复制下里面,生成一个新的SSH keys添加完成后在linux服务器上用命令ssh -T git@github.com进行测试
点“+”号创建一个私有仓库版本库的名称自定义,默认选择'public'创建完成之后出现如下版本库信息,选择https
创建测试文件并推送到githup上[root@localhost mycode]# echo '# everycode' >> README.md[root@localhost mycode]# git add README.md[root@localhost mycode]# git commit -m 'first commit'[root@localhost mycode]# git remote add origin git@github.com:heliang5241/everycode.git[root@localhost mycode]# git push -u origin masterThe authenticity of host 'github.com (192.30.255.113)' can't be established.RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.Counting objects: 3, done.Writing objects: 100% (3/3), 220 bytes, done.Total 3 (delta 0), reused 0 (delta 0)To git@github.com:heliang5241/everycode.git * [new branch] master -> masterBranch master set up to track remote branch master from origin.
登录githup进行验证如下图所示,代码已经成功推送到githup上
如果linux服务器上没有git,需要使用yum -y install git进行安装