aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-07-10 18:09:42 +0800
committerGitHub <noreply@github.com>2022-07-10 12:09:42 +0200
commit317c565e775a45ff90e4d947b0fb18cb480e04fe (patch)
tree0d6f74c508a07d10c0c7ff84cbd83ecb1885348d /modules/setting
parent1d02a9c9fbb84bca9e6fb1dd595b07e2524c3766 (diff)
downloadgitea-317c565e775a45ff90e4d947b0fb18cb480e04fe.tar.gz
gitea-317c565e775a45ff90e4d947b0fb18cb480e04fe.zip
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
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/setting.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 88f306b3fa..b9881fa5e6 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -862,9 +862,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)
}