配置Windows下的Git 服务器简易教程

  • 下载

msysGit

TortoiseGit

WampServer2

  • 配置Git

             cd C:\Program Files\Git\libexec\git-core
             copy C:\Program Files\Git\bin\libiconv-2.dll           
             git-http-backend.exe 

  • 配置Apache

修改httpd.conf :

<directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</directory>


在 httpd.conf 文件末尾追加:

# Set this to the root folder containing your Git repositories.
SetEnv GIT_PROJECT_ROOT E:/SvnServer
# Set this to export all projects by default (by default,
# git will only publish those repositories that contain a
# file named “git-daemon-export-ok”
SetEnv GIT_HTTP_EXPORT_ALL 1
# Route specific URLS matching this regular expression to the git http server.
ScriptAliasMatch \
“(?x)^/git/(.*/(HEAD | \
info/refs | \
objects/(info/[^/]+ | \
[0-9a-f]{2}/[0-9a-f]{38} | \
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
git-(upload|receive)-pack))$” \
“C:/Program Files/Git/libexec/git-core/git-http-backend.exe/$1″
 
<Location />
AuthType Basic
AuthName “GIT Server
AuthUserFile “E:/SvnServer/htpassword”
Require valid-user
</Location>



  • 添加用户

切换到 Apache 安装目录下的 bin目录

htpasswd -cmb E:/SvnServer/htpassword mythma 123456


  • 创建代码仓库


cd E:\GitServer
git init --bare mythma.git
git update-server-info



  • 客户端

使用TortoiseGit clone

git add .

git commit -m "Add"

git push origin master


你可能感兴趣的:(apache,apache,git,git)