From 71c7d0a993f4b4638697ad54b4c594ae8ef35b3c Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 30 Jun 2021 19:40:51 +0100 Subject: [PATCH] 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 --- templates/repo/empty.tmpl | 13 +++++++++++-- 1 file 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 {{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}} +git remote add origin {{$.CloneLink.HTTPS}} git push -u origin {{.Repository.DefaultBranch}} @@ -42,10 +42,19 @@ git push -u origin {{.Repository.DefaultBranch}}

{{.i18n.Tr "repo.push_exist_repo"}}

-
git remote add origin {{if $.DisableSSH}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}
+									
git remote add origin {{$.CloneLink.HTTPS}}
 git push -u origin {{.Repository.DefaultBranch}}
+ {{end}} {{else}}