Skip to content

Commit

Permalink
Do not create empty ".ssh" directory when loading config (go-gitea#20289
Browse files Browse the repository at this point in the history
)

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.
  • Loading branch information
wxiaoguang authored and Sysoev, Vladimir committed Aug 10, 2022
1 parent f60d559 commit d3f9b9e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,9 +859,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
SSH.AuthorizedPrincipalsAllow, SSH.AuthorizedPrincipalsEnabled = parseAuthorizedPrincipalsAllow(sec.Key("SSH_AUTHORIZED_PRINCIPALS_ALLOW").Strings(","))

if !SSH.Disabled && !SSH.StartBuiltinServer {
if err := os.MkdirAll(SSH.RootPath, 0o700); err != nil {
log.Fatal("Failed to create '%s': %v", SSH.RootPath, err)
} else if err = os.MkdirAll(SSH.KeyTestPath, 0o644); err != nil {
if err = os.MkdirAll(SSH.KeyTestPath, 0o644); err != nil {
log.Fatal("Failed to create '%s': %v", SSH.KeyTestPath, err)
}

Expand Down

0 comments on commit d3f9b9e

Please sign in to comment.