Automate ssh-keygen -t rsa so it does not ask for a passphrase

后端 未结 7 1705
臣服心动
臣服心动 2020-11-30 23:25

I need to automate ssh-keygen -t rsa with out a password i.e. enter at the prompt.
How can I do that from a shell script?

7条回答
  •  清歌不尽
    2020-11-30 23:45

    If you need to do this from PowerShell in windows use:

    ssh-keygen -f $Name -t rsa -N '""'
    

    note you also have to ensure the git bin directory is in your path:

    $sshPath = "\git\bin\"
    
    $env:path += ";$sshPath"
    

    Then to use it in PoshGit it's just:

    Add-SshKey "\.shh\KeyFilename"
    

提交回复
热议问题