From 45adb9b7a38cca896bf8fb3f27ccb29fc244b395 Mon Sep 17 00:00:00 2001
From: Unknwon <u@gogs.io>
Date: Sat, 8 Aug 2015 00:41:09 +0800
Subject: [PATCH] fix #1331

---
 models/repo.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/models/repo.go b/models/repo.go
index c61bef2f7e..73807a2f65 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -456,6 +456,7 @@ func initRepository(e Engine, repoPath string, u *User, repo *Repository, initRe
 	// Clone to temprory path and do the init commit.
 	tmpDir := filepath.Join(os.TempDir(), com.ToStr(time.Now().Nanosecond()))
 	os.MkdirAll(tmpDir, os.ModePerm)
+	defer os.RemoveAll(tmpDir)
 
 	_, stderr, err = process.Exec(
 		fmt.Sprintf("initRepository(git clone): %s", repoPath),