mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-25 12:01:36 +01:00
Return useful error on wrong sshkey path (#374)
close #366 Reviewed-on: https://gitea.com/gitea/tea/pulls/374 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Norwin <noerw@noreply.gitea.io> Co-authored-by: 6543 <6543@obermui.de> Co-committed-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
616127cedc
commit
ebb2c38a0a
@ -55,7 +55,7 @@ func readSSHPrivKey(keyFile string, passwordCallback pwCallback) (sig ssh.Signer
|
|||||||
}
|
}
|
||||||
sshKey, err := ioutil.ReadFile(keyFile)
|
sshKey, err := ioutil.ReadFile(keyFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("can not read ssh key '%s'", keyFile)
|
||||||
}
|
}
|
||||||
sig, err = ssh.ParsePrivateKey(sshKey)
|
sig, err = ssh.ParsePrivateKey(sshKey)
|
||||||
if _, ok := err.(*ssh.PassphraseMissingError); ok && passwordCallback != nil {
|
if _, ok := err.(*ssh.PassphraseMissingError); ok && passwordCallback != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user