From 1c4293b37fce7460fbf65b6f2a3c134d99f84762 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 10 Jan 2019 22:23:05 +0800 Subject: [PATCH] fix public will not be reused as public key after deleting as deploy key (#5671) (#5685) --- models/ssh_key.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models/ssh_key.go b/models/ssh_key.go index e782e1ed0..d0940bcef 100644 --- a/models/ssh_key.go +++ b/models/ssh_key.go @@ -826,6 +826,11 @@ func DeleteDeployKey(doer *User, id int64) error { if err = deletePublicKeys(sess, key.KeyID); err != nil { return err } + + // after deleted the public keys, should rewrite the public keys file + if err = rewriteAllPublicKeys(sess); err != nil { + return err + } } return sess.Commit()