package main import ( "net/http" ) func createRepo(w http.ResponseWriter, r *http.Request) { /* cmd := exec.Command(g.GitBinPath, args...) cmd.Dir = dir stdin, err := cmd.StdinPipe() */ w.Write([]byte("This is my home page")) } /* func CustomAuthenticator(authf func(info auth.AuthInfo) (bool, error)) func(http.Handler) http.Handler { return func(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { auth, err := parseAuthHeader(req.Header.Get("Authorization")) if err != nil { w.Header().Set("WWW-Authenticate", `Basic realm="git server"`) http.Error(w, err.Error(), 401) return } // Build up info from request headers and URL info := AuthInfo{ Username: auth.Name, Password: auth.Pass, Repo: repoName(req.URL.Path), Push: isPush(req), Fetch: isFetch(req), } // Call authentication function authenticated, err := authf(info) if err != nil { code := 500 msg := err.Error() if se, ok := err.(StatusError); ok { code = se.StatusCode() } http.Error(w, msg, code) return } // Deny access to repo if !authenticated { http.Error(w, "Forbidden", 403) return } // Access granted handler.ServeHTTP(w, req) }) } } */