托管私人仓库,无法找到http(s)

时间:2018-07-24 15:08:09

标签: git

我正在尝试在我们的本地网络中建立本地存储库,以便可以使远程计算机彼此同步并进行远程管理。 我着手实现这一目标的方法是在我们本地的Intranet中创建一个私有仓库。我已经在服务器上设置了运行Centos 7,Nginx,git和PHP-FPM的服务器(尽管我猜这实际上并不需要,但是无论如何都可以)。

我让Nginx没问题。我转到本地主机名的主要URL,并使用HTTPS正确加载了该主机名。

我现在的问题是,当我尝试运行git clone https://computer.example.com/git/repo.git时,它返回错误:fatal: repository https://computer.example.com/git/repo.git/ not found

我不知道如何正确地使用它。我不需要使用https来推送更新(尽管这样做会更容易)。

在没有人提及之前,没有其他选择。我这样做的目的是在没有防火墙的情况下,最少地安装软件,甚至不需要安装任何软件。无法访问互联网或其他任何内容。

这是我的Nginx网站配置:

listen      443 ssl http2;
listen      [::]:443 ssl http2;
server_name  computer.example.com;

ssl                 on;
ssl_certificate     /home/it/ssl/example.com/certs/STAR_example_com.bundle.crt;
ssl_certificate_key /home/it/ssl/example.com/csrs/ca-decrypted.key;


root   /home/it/sites/computer.example.com/public_html;

location ~ /git(/.*) {
    if ($arg_service = git-receive-pack) {
        rewrite /git(/.*) /git_write$1 last;
    }

    if ($uri ~ ^/git/.*/git-receive-pack$) {
        rewrite /git(/.*) /git_write$1 last;
    }

    if ($arg_service = git-upload-pack) {
        rewrite /git(/.*) /git_read$1 last;
    }

    if ($uri ~ ^/git/.*/git-upload-pack$) {
        rewrite /git(/.*) /git_read$1 last;
    }
}

location ~ /git_read(/.*) {
    include git-http-backend.conf;
    fastcgi_param GIT_PROJECT_ROOT /home/it/sites/computer.example.com/public_html/git;
}

location ~ /git_write(/.*) {
    auth_basic "Pushing to Git repositories is restricted";
    auth_basic_user_file /etc/nginx/.htpasswd;
    include git-http-backend.conf;
    fastcgi_param GIT_PROJECT_ROOT /home/it/sites/computer.example.com/public_html/git;
}


# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
    deny  all;
}

# deny access to .ini files
#
location ~ \.ini$ {
    deny  all;
}

git-http-backend.conf:

# /etc/nginx/git-http-backend.conf 
fastcgi_pass unix:/var/run/php-fpm/it.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param PATH_INFO $1;
fastcgi_param REMOTE_USER $remote_user;

php-fpm.d / it.conf :(如果需要)

[it]
user = it
group = it
;listen = 127.0.0.1:9000
listen = /var/run/php-fpm/it.sock
listen.owner = it
listen.group = it
listen.mode = 0660
php_admin_value[disable_functions] = passthru,shell_exec,system
;php_admin_flag[allow_url_fopen] = off
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 1
pm.max_spare_servers = 15
chdir = /

当然,我知道不需要某些部分,我只把它们留在那里。如果他们确实引起关注,请告诉我。我可以解决他们。

这就是repo.git目录中的内容:

branches/
config
description
HEAD
hooks/
info/
objects/
refs/

有什么想法吗?

0 个答案:

没有答案
相关问题