*安裝apache
*安裝git
*將git安裝目錄的bin\libiconv2.dll 和 libiconv-2.dll 複製到 libexec\git-core\ 下
*在D槽新增GitRepos,用來放git repository
*修改apache的httpd.config
修改Directory區塊如下
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
在最後面加入
#Set this to the root folder containing your Git repositories.
SetEnv GIT_PROJECT_ROOT D:/GitRepos
# 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
# Route specific URLS matching this regular expression to the git http server.
#若git的存放路徑不同,記得修改最後一行
ScriptAliasMatch \
"(?x)^/(.*/(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 (x86)/Git/libexec/git-core/git-http-backend.exe/$1"
<Location "/">
AuthType Basic
AuthName "GIT Repository"
AuthUserFile "D:/GitRepos/htpasswd/git.passwd"
Require valid-user
</Location>
*產生git.passwd
在命令列下,切換到apache底下的bin目錄
key下面指令: htpasswd -c git.passwd 使用者名稱
之後會要你輸入密碼
若要再產生另外一個帳號到同一個檔案
則輸入htpasswd -m git.passwd 使用者名稱
之後把bin目錄下的git.passwd搬到D:/GitRepos/htpasswd/
*重啟apache
*使用git的bash到D:/GitRepos
git init --bare --share TestProject
再切換到TestProject
git update-server-info
*之後就從client抓資料啦
沒有留言:
張貼留言