git clone如何通过http(s)服务器将.git后缀添加到URL

时间:2016-04-20 11:02:42

标签: git

我使用Ubuntu 14.04和Apache2(2.4.7)设置了一个git http(s)服务器。我在/ home / char / git /下创建了一个文件夹名test.git。

我成功了
  

git clone https://test.com/test.git

但是

失败了
  

git clone https://test.com/test

对于git protocal,两者都可以。我在Git Pro中尝试了git update-server-info和许多其他方法,但仍然在此处阻止。有没有人知道http(s)服务器因为遗漏.git而失败的原因。以下是我在apache2中的配置

        ServerName test.com
        DocumentRoot /home/char/git
        <Directory "/home/char/git">
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        AllowOverride None
        Require all granted
        </Directory>

        <LocationMatch "^/git/.*/git-receive-pack$">
        AuthType Basic
        AuthName "Git Repositories"
        Require valid-user
        </LocationMatch>

        SetEnv GIT_PROJECT_ROOT /home/char/git
        SetEnv GIT_HTTP_EXPORT_ALL
        SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
        ScriptAlias /git/ /usr/lib/git-core/git-http-backend/   

        SSLEngine on
        SSLCertificateFile    /etc/gitdata/mygit_ssl.crt
        SSLCertificateKeyFile /etc/gitdata/mygit_ssl.key

1 个答案:

答案 0 :(得分:0)

我认为这是因为有些回购被称为<something>而其他被称为<something>.git(特别是裸存储库)。