diff --git a/models/repo.go b/models/repo.go index eafb12f4716b..e27e99b056eb 100644 --- a/models/repo.go +++ b/models/repo.go @@ -200,6 +200,7 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv } c := exec.Command("git", "update-server-info") + c.Dir = repoPath err = c.Run() if err != nil { log.Error("repo.CreateRepository(exec update-server-info): %v", err) diff --git a/serve.go b/serve.go index ce1dc3184f5a..b84fa2a4e501 100644 --- a/serve.go +++ b/serve.go @@ -281,6 +281,7 @@ func runServ(k *cli.Context) { //runUpdate(k) c := exec.Command("git", "update-server-info") + c.Dir = models.RepoPath(user.Name, repoName) err := c.Run() if err != nil { log.Error("update-server-info: %v", err)