diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go
index 48aaca17cb..4d8fbcb7a5 100644
--- a/routers/web/auth/oauth.go
+++ b/routers/web/auth/oauth.go
@@ -1222,10 +1222,6 @@ func updateSSHPubIfNeed(
 			return err
 		}
 
-		if len(sshKeys) == 0 {
-			return nil
-		}
-
 		if asymkey_model.SynchronizePublicKeys(ctx, user, authSource, sshKeys) {
 			err = asymkey_model.RewriteAllPublicKeys(ctx)
 			if err != nil {