mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-16 01:43:24 +09:00
fix(repo): stop advertising HTTP clone URLs when DISABLE_HTTP_GIT is set (#38378)
Fixes #38339 --------- Signed-off-by: TowyTowy <towy@airreps.link> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<div class="ui segment center">{{ctx.Locale.Tr "repo.no_branch"}}</div>
|
||||
{{else if .CanWriteCode}}
|
||||
<h4 class="ui top attached header">{{ctx.Locale.Tr "repo.quick_guide"}}</h4>
|
||||
<div class="ui attached guide table segment empty-repo-guide">
|
||||
<div class="ui attached segment empty-repo-guide flex-relaxed-list">
|
||||
<div class="item">
|
||||
<h3>{{ctx.Locale.Tr "repo.clone_this_repo"}} <small>{{ctx.Locale.Tr "repo.clone_helper" "http://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository"}}</small></h3>
|
||||
|
||||
@@ -36,12 +36,15 @@
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{template "repo/clone_buttons" .}}
|
||||
{{template "repo/clone_buttons" dict "CloneButtonOriginLink" $.CloneButtonOriginLink}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if not .Repository.IsArchived}}
|
||||
<div class="divider tw-my-0"></div>
|
||||
{{$cloneLink := $.CloneButtonOriginLink}}
|
||||
{{$showGitClientCommands := and (or $cloneLink.SupportHTTPS $cloneLink.SupportSSH) (not .Repository.IsArchived)}}
|
||||
{{/* TODO: when both HTTPS and SSH are disabled, the UI is not that good */}}
|
||||
{{if $showGitClientCommands}}
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="item">
|
||||
<h3>{{ctx.Locale.Tr "repo.create_new_repo_command"}}</h3>
|
||||
@@ -52,19 +55,19 @@ git init{{if ne .Repository.ObjectFormatName "sha1"}} --object-format={{.Reposit
|
||||
{{if ne .Repository.DefaultBranch "master"}}git checkout -b {{.Repository.DefaultBranch}}{{end}}
|
||||
git add README.md
|
||||
git commit -m "first commit"
|
||||
git remote add {{$gitRemoteName}} <span class="js-clone-url">{{$.CloneButtonOriginLink.HTTPS}}</span>
|
||||
git remote add {{$gitRemoteName}} <span class="js-clone-url">{{Iif $cloneLink.SupportHTTPS $cloneLink.HTTPS $cloneLink.SSH}}</span>
|
||||
git push -u {{$gitRemoteName}} {{.Repository.DefaultBranch}}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="item">
|
||||
<h3>{{ctx.Locale.Tr "repo.push_exist_repo"}}</h3>
|
||||
<div class="markup">
|
||||
<pre><code>git remote add {{$gitRemoteName}} <span class="js-clone-url">{{$.CloneButtonOriginLink.HTTPS}}</span>
|
||||
<pre><code>git remote add {{$gitRemoteName}} <span class="js-clone-url">{{Iif $cloneLink.SupportHTTPS $cloneLink.HTTPS $cloneLink.SSH}}</span>
|
||||
git push -u {{$gitRemoteName}} {{.Repository.DefaultBranch}}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="item">HTTPS and SSH clones are disabled, you can only modify the repository via Gitea's web UI.</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{else}}
|
||||
|
||||
Reference in New Issue
Block a user