Fix the Git HTTPS URL and access

dc27f5ada5eeca438353fcee3ea03964201ce7d7
Alexis Sellier committed ago 1 parent 186f39b9
git_http.go +3 -0
32 32
	handler := &cgi.Handler{
33 33
		Path: gitHTTPBackend,
34 34
		Env: []string{
35 35
			"GIT_PROJECT_ROOT=" + s.scanPath,
36 36
			"GIT_HTTP_EXPORT_ALL=1",
37 +
			"GIT_CONFIG_COUNT=1",
38 +
			"GIT_CONFIG_KEY_0=safe.directory",
39 +
			"GIT_CONFIG_VALUE_0=*",
37 40
		},
38 41
		InheritEnv: []string{"PATH"},
39 42
	}
40 43
41 44
	// Override PATH_INFO for the CGI handler.
handler.go +2 -2
82 82
		s.handleIndex(w, r)
83 83
		return
84 84
	}
85 85
86 86
	segments := strings.SplitN(path, "/", 3)
87 -
	repoName := segments[0]
87 +
	repoName := strings.TrimSuffix(segments[0], ".git")
88 88
89 89
	repo, ok := s.repos[repoName]
90 90
	if !ok {
91 91
		s.renderError(w, r, http.StatusNotFound, "Repository not found")
92 92
		return
191 191
		scheme = "http"
192 192
	}
193 193
	if proto := r.Header.Get("X-Forwarded-Proto"); proto != "" {
194 194
		scheme = proto
195 195
	}
196 -
	cloneHTTPS := scheme + "://" + r.Host + s.baseURL + "/" + repo.Name
196 +
	cloneHTTPS := scheme + "://" + r.Host + s.baseURL + "/" + repo.Name + ".git"
197 197
198 198
	pd.Data = homeData{
199 199
		DefaultRef: ref,
200 200
		Branches:   branches,
201 201
		Tree:       tree,