mirror of
https://github.com/go-gitea/gitea
synced 2024-11-18 16:01:36 +01:00
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>
This commit is contained in:
parent
7d70a6eff8
commit
71c7d0a993
1 changed files with 11 additions and 2 deletions
|
@ -33,7 +33,7 @@ git init
|
||||||
{{if ne .Repository.DefaultBranch "master"}}git checkout -b {{.Repository.DefaultBranch}}{{end}}
|
{{if ne .Repository.DefaultBranch "master"}}git checkout -b {{.Repository.DefaultBranch}}{{end}}
|
||||||
git add README.md
|
git add README.md
|
||||||
git commit -m "first commit"
|
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>
|
git push -u origin {{.Repository.DefaultBranch}}</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,10 +42,19 @@ git push -u origin {{.Repository.DefaultBranch}}</code></pre>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<h3>{{.i18n.Tr "repo.push_exist_repo"}}</h3>
|
<h3>{{.i18n.Tr "repo.push_exist_repo"}}</h3>
|
||||||
<div class="markup">
|
<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>
|
git push -u origin {{.Repository.DefaultBranch}}</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</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}}
|
{{end}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="ui segment center">
|
<div class="ui segment center">
|
||||||
|
|
Loading…
Reference in a new issue