[英]Git + Smart Http(s): 403 Error
盡管我讀了很多文章,但無法解決此問題。
我想在樹莓派上使用遠程存儲庫來使用Git + Smart Http。
我在Arch Linux上運行。
首先,讓我們考慮一下Http配置(而不是https)。
Apache和Git已正確安裝在我的Rasperry Pi上,並且Http連接的端口為8080。
在我的Raspberry Pi上:
1.我沒有在/etc/httpd/conf/http.conf中注釋有關mod_cgi,mod_alias和mod_env的行
2.我在/etc/httpd/conf/http.conf中添加了以下幾行:
SetEnv GIT_PROJECT_ROOT /srv/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
<Directory "/usr/lib/git-core*">
Require all granted
</Directory>
我已經創建了目錄/ srv / git
# mkdir -p /srv/git
我已經創建並初始化了一個git倉庫:
# mkdir -p /srv/git/test.git
# git init --bare
我更改了倉庫的所有者和組:
# chown -R http:http /srv/git/test.git
在我的客戶上:
我已經將存儲庫克隆到了文件夾中
$ git clone http://address:8080/git/test.git
我創建並添加了一個新文件,並且已經提交
$ nano test.c
$ git add test.c
$ git commit -m 'first'
我已經在Rasperry Pi上推送了新項目
$ git push origin master
但是我有這個錯誤:
atal: unable to access 'address:8080/git/test.git/';: The requested URL returned error: 403
如果克隆的測試文件夾內的回購(在你初始化的混帳回購協議),這意味着你必須:
test/test
如果從第一個測試文件夾中推送,則該存儲庫將沒有任何來源。
嘗試嘗試刪除所有測試文件夾,然后重新開始:
git clone http://address:8080/git/test.git
cd test
# work
git add .
git commit -m "work"
git push -u origin master
關於403錯誤,我將在服務器Apache(2.4)端重新命令:
<Directory "/usr/lib/git-core*">
Options ExecCGI Indexes
Order allow,deny
Allow from all
Require all granted
</Directory>
和:
<LocationMatch "^/.*/git-receive-pack$">
Options +ExecCGI
Require all granted
</LocationMatch>
<LocationMatch "^/.*/git-upload-pack$">
Options +ExecCGI
Require all granted
</LocationMatch>
另外,在服務器上的git nude repo文件夾中:
cd /srv/git/test.git
git config --file config http.receivepack true
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.