From a3f4c5e7c9fa88af81a4d66da4688cc2e90227c1 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Tue, 29 Jun 2021 21:18:46 +0100 Subject: [PATCH 1/2] 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 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl index 21c600545639d..e1c1b8052d082 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,18 @@ 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}}
From 14c399c8219434f54c176d13c156ef3705c06cf6 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Tue, 29 Jun 2021 21:25:54 +0100 Subject: [PATCH 2/2] go away linter Signed-off-by: Andrew Thornton --- templates/repo/empty.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl index e1c1b8052d082..485a6aa4e55f0 100644 --- a/templates/repo/empty.tmpl +++ b/templates/repo/empty.tmpl @@ -47,9 +47,10 @@ git push -u origin {{.Repository.DefaultBranch}}