Index: pkg/mod/github.com/go-openapi/validate@v0.20.2/fixtures/validation/fixture-additional-items Index: src/github.com/go-gitea/gitea/models/repo.go --- src/github.com/go-gitea/gitea/models/repo.go.orig 2021-08-05 19:43:23.000000000 +0200 +++ src/github.com/go-gitea/gitea/models/repo.go 2021-08-06 09:18:22.283172000 +0200 @@ -941,11 +941,23 @@ } if setting.SSH.Port != 22 { - cl.SSH = fmt.Sprintf("ssh://%s@%s/%s/%s.git", sshUser, net.JoinHostPort(setting.SSH.Domain, strconv.Itoa(setting.SSH.Port)), repo.OwnerName, repoName) + if setting.SSH.StartBuiltinServer { + cl.SSH = fmt.Sprintf("ssh://%s/%s/%s.git", net.JoinHostPort(setting.SSH.Domain, strconv.Itoa(setting.SSH.Port)), repo.OwnerName, repoName) + } else { + cl.SSH = fmt.Sprintf("ssh://%s@%s/%s/%s.git", sshUser, net.JoinHostPort(setting.SSH.Domain, strconv.Itoa(setting.SSH.Port)), repo.OwnerName, repoName) + } } else if setting.Repository.UseCompatSSHURI { - cl.SSH = fmt.Sprintf("ssh://%s@%s/%s/%s.git", sshUser, sshDomain, repo.OwnerName, repoName) + if setting.SSH.StartBuiltinServer { + cl.SSH = fmt.Sprintf("ssh://%s/%s/%s.git", sshDomain, repo.OwnerName, repoName) + } else { + cl.SSH = fmt.Sprintf("ssh://%s@%s/%s/%s.git", sshUser, sshDomain, repo.OwnerName, repoName) + } } else { - cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", sshUser, sshDomain, repo.OwnerName, repoName) + if setting.SSH.StartBuiltinServer { + cl.SSH = fmt.Sprintf("%s:%s/%s.git", sshDomain, repo.OwnerName, repoName) + } else { + cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", sshUser, sshDomain, repo.OwnerName, repoName) + } } cl.HTTPS = ComposeHTTPSCloneURL(repo.OwnerName, repoName) return cl Index: src/github.com/go-gitea/gitea/models/ssh_key_authorized_keys.go --- src/github.com/go-gitea/gitea/models/ssh_key_authorized_keys.go.orig 2021-08-05 19:43:23.000000000 +0200 +++ src/github.com/go-gitea/gitea/models/ssh_key_authorized_keys.go 2021-08-07 09:26:05.921313000 +0200 @@ -47,7 +47,7 @@ func AuthorizedStringForKey(key *PublicKey) string { sb := &strings.Builder{} _ = setting.SSH.AuthorizedKeysCommandTemplateTemplate.Execute(sb, map[string]interface{}{ - "AppPath": util.ShellEscape(setting.AppPath), + "AppPath": util.ShellEscape("@l_prefix@/sbin/gitea-serv"), "AppWorkPath": util.ShellEscape(setting.AppWorkPath), "CustomConf": util.ShellEscape(setting.CustomConf), "CustomPath": util.ShellEscape(setting.CustomPath),