1、如何让git push 时自动输入密码?

解:使用ssh-agent

例:

[xiao@localhost project]$ ssh-agent bash
[xiao@localhost project]$ ssh-add
Enter passphrase for /home/xiao/.ssh/id_rsa:
Identity added: /home/xiao/.ssh/id_rsa (/home/xiao/.ssh/id_rsa)
 
2、ssh常用命令

ssh-keygen 可以在~/.ssh目录下生成 id_rsa(私钥) 和 id_rsa.pub(公钥)。

如需在对应远程主机上建立对应的passphrase,就需要将id_rsa.pub(公钥)拷到远程主机上的~/.ssh/authorized_keys2

authorized_keys2可以写多条,多条之间用换行隔开。

一般需要将私钥的权限设为600

 

scp操作:

scp -P 2222 ~/.ssh/authorized_keys2 xiao@192.168.11.10:.ssh/authorized_keys2_nn

相关文章:

  • 2022-01-18
  • 2021-09-18
  • 2021-08-29
  • 2021-10-15
  • 2022-03-01
  • 2022-03-01
  • 2022-12-23
  • 2022-03-06
猜你喜欢
  • 2022-12-23
  • 2021-07-07
  • 2021-09-06
  • 2021-08-28
  • 2022-12-23
  • 2021-06-05
  • 2021-08-20
相关资源
相似解决方案