diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index b25c942316..62c67bcee1 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -70,6 +70,7 @@ func RepoAssignment(redirect bool) martini.Handler { } ctx.Repo.Repository = repo ctx.Repo.CloneLink.SSH = fmt.Sprintf("git@%s:%s/%s.git", base.Domain, user.LowerName, repo.LowerName) + ctx.Repo.CloneLink.HTTPS = fmt.Sprintf("https://%s/%s/%s.git", base.Domain, user.LowerName, repo.LowerName) ctx.Data["IsRepositoryValid"] = true ctx.Data["Repository"] = repo diff --git a/templates/repo/single_bare.tmpl b/templates/repo/single_bare.tmpl index caf2ef7498..999ff557b0 100644 --- a/templates/repo/single_bare.tmpl +++ b/templates/repo/single_bare.tmpl @@ -6,8 +6,8 @@

Clone this repository

- - + + @@ -20,12 +20,12 @@
touch README.md
 git init
 git add README.md
-git commit -m "first commit"
-git remote add origin https://github.com/fuxiaohei/air.git
+git commit -m "first commit" {{.CloneLink.SSH}}
+git remote add origin {{.CloneLink.HTTPS}}
 git push -u origin master

Push an existing repository from the command line

-
git remote add origin https://github.com/fuxiaohei/air.git
+        
git remote add origin {{.CloneLink.HTTPS}}
 git push -u origin master
\ No newline at end of file