Skip to content

Commit 317c565

Browse files
authored
Do not create empty ".ssh" directory when loading config (#20289) (#20298)
Backport #20289 The code is as old as back to 2016, creating the directory automatically is not correct IMO. 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 1d02a9c commit 317c565

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
@@ -862,9 +862,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
862862
SSH.AuthorizedPrincipalsAllow, SSH.AuthorizedPrincipalsEnabled = parseAuthorizedPrincipalsAllow(sec.Key("SSH_AUTHORIZED_PRINCIPALS_ALLOW").Strings(","))
863863

864864
if !SSH.Disabled && !SSH.StartBuiltinServer {
865-
if err := os.MkdirAll(SSH.RootPath, 0o700); err != nil {
866-
log.Fatal("Failed to create '%s': %v", SSH.RootPath, err)
867-
} else if err = os.MkdirAll(SSH.KeyTestPath, 0o644); err != nil {
865+
if err = os.MkdirAll(SSH.KeyTestPath, 0o644); err != nil {
868866
log.Fatal("Failed to create '%s': %v", SSH.KeyTestPath, err)
869867
}
870868

0 commit comments

Comments
 (0)