繁体   English   中英

Git +智能Http(s):403错误

[英]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>
  1. 我已经创建了目录/ srv / git

     # mkdir -p /srv/git 

  2. 我已经创建并初始化了一个git仓库:

     # mkdir -p /srv/git/test.git 
     # git init --bare 

  3. 我更改了仓库的所有者和组:

     # chown -R http:http /srv/git/test.git 

在我的客户上:

  1. 我已经将存储库克隆到了文件夹中

     $ git clone http://address:8080/git/test.git 

  2. 我创建并添加了一个新文件,并且已经提交

     $ nano test.c 
     $ git add test.c 
     $ git commit -m 'first' 

  3. 我已经在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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM