项目作者: asim

项目描述 :
Git Smart HTTP in Go
高级语言: Go
项目地址: git://github.com/asim/git-http-backend.git
创建时间: 2013-03-24T23:18:12Z
项目社区:https://github.com/asim/git-http-backend

开源协议:

下载


Git HTTP Backend

This is a Go based implementation of Grack (a Rack application), which aimed
to replace the builtin git-http-backed CGI handler distributed with C Git.
Grack was written to allow far more webservers to handle Git smart http
requests. The aim of this project is to improve Git smart http performance by
utilising the power of Go.

Dependencies

  • Git >= 1.7

Install

  1. go get github.com/asim/git-http-backend

Usage

Run the backend pointing to a project root and git bin path

  1. git-http-backend --project_root=/tmp --git_bin_path=/usr/bin/git

Help

  1. git-http-backend --help

Flags

  1. Usage of ./git-http-backend:
  2. -require_auth bool
  3. set require auth enable/disable
  4. -auth_pass_env_var string
  5. set an env var to provide the basic auth pass as
  6. -auth_user_env_var string
  7. set an env var to provide the basic auth user as
  8. -default_env string
  9. set the default env
  10. -git_bin_path string
  11. set git bin path (default "/usr/bin/git")
  12. -project_root string
  13. set project root (default "/tmp")
  14. -route_prefix string
  15. prepend a regex prefix to each git-http-backend route
  16. -server_address string
  17. set server address (default ":8080")

Server

To embed your own server import and use the package

  1. package main
  2. import (
  3. "log"
  4. "net/http"
  5. "github.com/asim/git-http-backend/server"
  6. )
  7. func main() {
  8. http.HandleFunc("/", server.Handler())
  9. if err := http.ListenAndServe(":8080", nil); err != nil {
  10. log.Fatal("ListenAndServe: ", err)
  11. }
  12. }

License

  1. (The MIT License)
  2. Copyright (c) 2013 Asim Aslam <asim@aslam.me>
  3. Permission is hereby granted, free of charge, to any person obtaining
  4. a copy of this software and associated documentation files (the
  5. 'Software'), to deal in the Software without restriction, including
  6. without limitation the rights to use, copy, modify, merge, publish,
  7. distribute, sublicense, and/or sell copies of the Software, and to
  8. permit persons to whom the Software is furnished to do so, subject to
  9. the following conditions:
  10. The above copyright notice and this permission notice shall be
  11. included in all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  13. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  15. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  16. CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  17. TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  18. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. ````