请.git目录网站无法访问无法访问、目录、网站、git

2023-09-02 00:21:16 作者:狼噬夜メ魇

我有我使用github上(闭源)跟踪变化和更新的网站一个网站。唯一的问题是,它出现在.git目录是通过网络进行访问。我怎样才能阻止这一点,仍然可以使用git?

I have a website that I use github (closed source) to track changes and update site. The only problem is, it appears the .git directory is accessible via the web. How can I stop this and still be able to use git?

我应该使用的.htaccess? 我应该改变git的权限?

Should I use .htaccess? Should I change permissions of .git?

推荐答案

创建一个的.htaccess 文件中的 git的文件夹,并把下面这个文件:

Create a .htaccess file in the .git folder and put the following in this file:

Order allow,deny
Deny from all