Support SSH for go get (#24664)
fix #12192 Support SSH for go get --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: mfk <mfk@hengwei.com.cn> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
49808136c5
commit
4b80813341
7 changed files with 68 additions and 15 deletions
|
@ -66,7 +66,14 @@ func goGet(ctx *context.Context) {
|
|||
}
|
||||
|
||||
goGetImport := context.ComposeGoGetImport(ownerName, trimmedRepoName)
|
||||
goImportContent := fmt.Sprintf("%s git %s", goGetImport, repo_model.ComposeHTTPSCloneURL(ownerName, repoName) /*CloneLink*/)
|
||||
|
||||
var cloneURL string
|
||||
if setting.Repository.GoGetCloneURLProtocol == "ssh" {
|
||||
cloneURL = repo_model.ComposeSSHCloneURL(ownerName, repoName)
|
||||
} else {
|
||||
cloneURL = repo_model.ComposeHTTPSCloneURL(ownerName, repoName)
|
||||
}
|
||||
goImportContent := fmt.Sprintf("%s git %s", goGetImport, cloneURL /*CloneLink*/)
|
||||
goSourceContent := fmt.Sprintf("%s _ %s %s", goGetImport, prefix+"{/dir}" /*GoDocDirectory*/, prefix+"{/dir}/{file}#L{line}" /*GoDocFile*/)
|
||||
goGetCli := fmt.Sprintf("go get %s%s", insecure, goGetImport)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue