From ebb2c38a0acb2810ca8f12d065269182a0b3f042 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 29 Jun 2021 15:54:43 +0800 Subject: [PATCH] Return useful error on wrong sshkey path (#374) close #366 Reviewed-on: https://gitea.com/gitea/tea/pulls/374 Reviewed-by: Lunny Xiao Reviewed-by: Norwin Co-authored-by: 6543 <6543@obermui.de> Co-committed-by: 6543 <6543@obermui.de> --- modules/git/auth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/git/auth.go b/modules/git/auth.go index 2334ab7..3245512 100644 --- a/modules/git/auth.go +++ b/modules/git/auth.go @@ -55,7 +55,7 @@ func readSSHPrivKey(keyFile string, passwordCallback pwCallback) (sig ssh.Signer } sshKey, err := ioutil.ReadFile(keyFile) if err != nil { - return nil, err + return nil, fmt.Errorf("can not read ssh key '%s'", keyFile) } sig, err = ssh.ParsePrivateKey(sshKey) if _, ok := err.(*ssh.PassphraseMissingError); ok && passwordCallback != nil {