summaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorPatrick G <geek1011@outlook.com>2017-10-14 11:51:00 -0400
committerLauris BH <lauris@nix.lv>2017-10-14 18:51:00 +0300
commite89bb7ef6a6848615a56f8c568ae335de0c2e9e7 (patch)
treeaab1716cd9dffc017d27fe91b04364ed5004bd7b /models/repo.go
parent514006a2e5a33074fba5ac2deab9ab91cf5713a2 (diff)
downloadgitea-e89bb7ef6a6848615a56f8c568ae335de0c2e9e7.tar.gz
gitea-e89bb7ef6a6848615a56f8c568ae335de0c2e9e7.zip
Allow custom SSH user in UI for built-in SSH server (#2617) (#2678)
* Allow custom SSH user in UI for built-in SSH server (#2617) * Some fixes * Did make fmt * Updated according to review - Renamed config to BUILTIN_SSH_SERVER_USER - Removed unnecessary default string value for config item * Updated according to review * Fixed some minor issues
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/models/repo.go b/models/repo.go
index 740bbe8da9..7ad9ad4dc9 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -806,14 +806,19 @@ func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
repoName += ".wiki"
}
+ sshUser := setting.RunUser
+ if setting.SSH.StartBuiltinServer {
+ sshUser = setting.SSH.BuiltinServerUser
+ }
+
repo.Owner = repo.MustOwner()
cl := new(CloneLink)
if setting.SSH.Port != 22 {
- cl.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port, repo.Owner.Name, repoName)
+ cl.SSH = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", sshUser, setting.SSH.Domain, setting.SSH.Port, repo.Owner.Name, repoName)
} else if setting.Repository.UseCompatSSHURI {
- cl.SSH = fmt.Sprintf("ssh://%s@%s/%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoName)
+ cl.SSH = fmt.Sprintf("ssh://%s@%s/%s/%s.git", sshUser, setting.SSH.Domain, repo.Owner.Name, repoName)
} else {
- cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoName)
+ cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", sshUser, setting.SSH.Domain, repo.Owner.Name, repoName)
}
cl.HTTPS = ComposeHTTPSCloneURL(repo.Owner.Name, repoName)
return cl