git生成秘钥之后同步到服务器

时间:2023-03-08 21:11:32
git生成秘钥之后同步到服务器

现在本地生成ssh私钥和公钥

    • 设置本地git用户配置

      $ git config --global user.name "username"
      $ git config --global user.email "user@email.com"

    • 创建SSH Key,私钥和公钥

      $ ssh-keygen -t rsa -C "user@email.com"

ssh-copy-id root@192.168.1.xxx
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.1.xxx's password:
Permission denied, please try again.
root@192.168.1.xxx's password: