summaryrefslogtreecommitdiffstats
path: root/templates/repo/empty.tmpl
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-06-30 19:40:51 +0100
committerGitHub <noreply@github.com>2021-06-30 20:40:51 +0200
commit71c7d0a993f4b4638697ad54b4c594ae8ef35b3c (patch)
treee019f149e169f437875234d267cb46ab5fded110 /templates/repo/empty.tmpl
parent7d70a6eff8a8fb03f02c606f5dcacccb9c1cab47 (diff)
downloadgitea-71c7d0a993f4b4638697ad54b4c594ae8ef35b3c.tar.gz
gitea-71c7d0a993f4b4638697ad54b4c594ae8ef35b3c.zip
Fix default push instructions on empty repos (#16302)
* Fix default push instructions on empty repos Use script block like in `repo/clone_buttons.tmpl` to set default instructions for pushing to empty repos. Fix #16295 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'templates/repo/empty.tmpl')
-rw-r--r--templates/repo/empty.tmpl13
1 files changed, 11 insertions, 2 deletions
diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl
index 21c6005456..485a6aa4e5 100644
--- a/templates/repo/empty.tmpl
+++ b/templates/repo/empty.tmpl
@@ -33,7 +33,7 @@ git init
{{if ne .Repository.DefaultBranch "master"}}git checkout -b {{.Repository.DefaultBranch}}{{end}}
git add README.md
git commit -m "first commit"
-git remote add origin <span class="clone-url">{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}</span>
+git remote add origin <span class="clone-url">{{$.CloneLink.HTTPS}}</span>
git push -u origin {{.Repository.DefaultBranch}}</code></pre>
</div>
</div>
@@ -42,10 +42,19 @@ git push -u origin {{.Repository.DefaultBranch}}</code></pre>
<div class="item">
<h3>{{.i18n.Tr "repo.push_exist_repo"}}</h3>
<div class="markup">
- <pre><code>git remote add origin <span class="clone-url">{{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}</span>
+ <pre><code>git remote add origin <span class="clone-url">{{$.CloneLink.HTTPS}}</span>
git push -u origin {{.Repository.DefaultBranch}}</code></pre>
</div>
</div>
+ <script defer>
+ /* eslint-disable no-undef */
+ const cloneUrls = document.getElementsByClassName('clone-url');
+ if (cloneUrls) {
+ for (let i = 0; i < cloneUrls.length; i++) {
+ cloneUrls[i].textContent = (isSSH ? sshButton : httpsButton).dataset.link;
+ }
+ }
+ </script>
{{end}}
{{else}}
<div class="ui segment center">