美文网首页
Linux搭建私有Git服务器以及ssh免密登陆配置

Linux搭建私有Git服务器以及ssh免密登陆配置

作者: 搞好关系 | 来源:发表于2018-09-18 19:31 被阅读15次

参考网址

操作指南【密码默认为:git】

本地生成公钥然后上传至服务器

<!--会覆盖别人的rsa,不建议使用-->
     scp -p ~/.ssh/id_rsa.pub git@192.168.3.44:/home/git/.ssh/authorized_keys
    
<!--  建议使用此方法  -->
ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host

例如:ssh-copy-id -i ~/.ssh/id_rsa.pub git@192.168.3.44

clone到本地

    git clone git@192.168.3.44:some-source.git
    
    远程
    git clone git@119.40.53.50:some-source.git
    

``

推送到远程

    git push origin [branch名称]

关联远程分支

git remote add origin git@ip.port:Library.git

合并

    在分支上
    git merge origin [branch名称]
    在master
    git merge [branch名称]

mac生成rsa

    ssh-keygen -t rsa -C “您的邮箱地址”
    cd ~/.ssh
    open .
    将公钥传至服务器 /home/git/.ssh/authorized_keys中
    

相关文章

网友评论

      本文标题:Linux搭建私有Git服务器以及ssh免密登陆配置

      本文链接:https://www.haomeiwen.com/subject/ptzlnftx.html