Browse Source

use absolute path in SSH clone link

if setting.RepoRootPath != home directory of setting.RunUser,
and
if using system ssh service,
relative path in SSH clone link will lead to a git clone failure
pull/4789/head
Siwei Chen 7 years ago committed by GitHub
parent
commit
117fba39cd
  1. 4
      models/repo.go

4
models/repo.go

@ -620,9 +620,9 @@ func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
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, repoLowerName)
cl.SSH = fmt.Sprintf("ssh://%s@%s:%d%s/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port, setting.RepoRootPath, repo.Owner.Name, repoLowerName)
} else {
cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoLowerName)
cl.SSH = fmt.Sprintf("%s@%s:%s/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.RepoRootPath, repo.Owner.Name, repoLowerName)
}
cl.HTTPS = ComposeHTTPSCloneURL(repo.Owner.Name, repoName)
return cl

Loading…
Cancel
Save