From 477c1283e920dcb7b18015f7d9058efc37dcd9f2 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 10 Jan 2019 02:10:46 +0800 Subject: [PATCH] fix public will not be reused as public key after deleting as deploy key (#5671) --- models/ssh_key.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models/ssh_key.go b/models/ssh_key.go index e782e1ed0b07..d0940bcef4bc 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()