Skip to content

Instantly share code, notes, and snippets.

@yousan
Last active August 29, 2015 14:16
Show Gist options
  • Save yousan/6aa379e6cf0de567d98f to your computer and use it in GitHub Desktop.
Save yousan/6aa379e6cf0de567d98f to your computer and use it in GitHub Desktop.
今風にUbuntuにGitの公開サーバを立てた ref: http://qiita.com/yousan/items/d102833d867972fbed6d
sudo aptitude install git apache22 gitweb
shell> sudo mkdir -p /mnt/git_repositories/sandbox.git
shell> cd /mnt/git_repositories/sandbox.git
shell> sudo git --bare init --shared=true
shell> sudo git update-server-info
shell> sudo chown -R www:www /mnt/git_repositories`
shell> git clone http://git.example.com/git/sandbox.git ./sandbox
shell> cd sandbox; touch hoge; git add hoge; git commit -m 'first commit'
shell> git push
conf:/etc/apache2/sites-available/git
<Directory />
Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
Deny from all
AuthType Basic
AuthName "Private"
AuthBasicProvider ldap
AuthzLDAPAuthoritative on
AuthLDAPURL ldap://ldap.example.com/ou=people,dc=example,dc=com?uid
Satisfy all
require ldap-user username
</Directory>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName git.example.com
DocumentRoot /mnt/git_repositories/
SetEnv GIT_PROJECT_ROOT /mnt/git_repositories/
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git /usr/lib/git-core/git-http-backend
<Location />
Order deny,allow
Deny from all
AuthType Basic
AuthName "Git Access"
AuthUserFile /mnt/git_repositories/.htpasswd
AuthGroupFile /dev/null
Require valid-user
</Location>
ErrorLog ${APACHE_LOG_DIR}/error_git.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
# LogLevel debug
CustomLog ${APACHE_LOG_DIR}/access_git.log combined
</VirtualHost>
<Directory />
# Options FollowSymLinks
Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All
AuthType Basic
AuthName "Private"
AuthBasicProvider ldap
AuthLDAPURL ldap://ldap.example.com/ou=people,dc=example,dc=com?uid
Satisfy all
require ldap-user username
</Directory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment