-
本文介绍通过搭建git服务器实现提交代码到
master
分支时完成网站应用代码的部署。创建SSH-Public-Key
本地计算机需要创建SSH公钥与服务器通信。使用
ssh-keygen
生产公钥以及私钥。$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/finalize/.ssh/id_rsa): demo Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in demo. Your public key has been saved in demo.pub. The key fingerprint is: 6d:07:2c:56:48:aa:0d:08:ad:c1:db:ce:0f:bf:4e:6b finalize@junjie The key's randomart image is: +--[ RSA 2048]----+ |o. .... | |.o.. ..o | | o+ . . o o | |.. . + . o . | | o . . S o . | | + . . | | +. | | .E. | | o+. | +-----------------+
然后在
ssh
的配置文件中加入demo.pub
的配置$ vi ~/.ssh/config $ chmod 600 ~/.ssh/config