diff --git a/pkg/context/context.go b/pkg/context/context.go index ed97395bf..ae3e39429 100644 --- a/pkg/context/context.go +++ b/pkg/context/context.go @@ -243,6 +243,16 @@ func Contexter() macaron.Handler { branchName = repo.DefaultBranch } + cloneLink := models.ComposeHTTPSCloneURL(ownerName, repoName) + + if setting.Repository.DisableHTTPGit { + if setting.SSH.Port != 22 { + cloneLink = fmt.Sprintf("ssh://%s@%s:%d/%s/%s.git", setting.RunUser, setting.SSH.Domain, setting.SSH.Port, ownerName, repoName) + } else { + cloneLink = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, ownerName, repoName) + } + } + prefix := setting.AppURL + path.Join(ownerName, repoName, "src", branchName) c.PlainText(http.StatusOK, []byte(com.Expand(`