Skip to content

Commit 36353e2

Browse files
authored
Do not create empty ".ssh" directory when loading config (#20289)
Creating the directory automatically is not correct. In other places for ssh key writing (RewriteAllPrincipalKeys / appendAuthorizedKeysToFile, etc), the directory will still be created when updating the keys. This PR will resolve the confusing and annoying problem: the dummy and empty ".ssh" directory in new git home.
1 parent 49f9d43 commit 36353e2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

modules/setting/setting.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -859,9 +859,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
859859
SSH.AuthorizedPrincipalsAllow, SSH.AuthorizedPrincipalsEnabled = parseAuthorizedPrincipalsAllow(sec.Key("SSH_AUTHORIZED_PRINCIPALS_ALLOW").Strings(","))
860860

861861
if !SSH.Disabled && !SSH.StartBuiltinServer {
862-
if err := os.MkdirAll(SSH.RootPath, 0o700); err != nil {
863-
log.Fatal("Failed to create '%s': %v", SSH.RootPath, err)
864-
} else if err = os.MkdirAll(SSH.KeyTestPath, 0o644); err != nil {
862+
if err = os.MkdirAll(SSH.KeyTestPath, 0o644); err != nil {
865863
log.Fatal("Failed to create '%s': %v", SSH.KeyTestPath, err)
866864
}
867865

0 commit comments

Comments
 (0)