当前位置: 首页 > 工具软件 > GitList > 使用案例 >

maven 安装本地仓库_为本地仓库安装GitList

夏侯星洲
2023-12-01

maven 安装本地仓库

GitHub is a great solution for code collaboration and repository management, but some individuals and companies don’t feel secure hosting their code in the cloud and instead prefer to maintain an intranet. Making your repositories available in a local intranet is pretty easy, but having a nice interface to interact with those repositories, making collaboration between teams easier, is not that simple.

GitHub是代码协作和存储库管理的绝佳解决方案,但有些个人和公司并不觉得将代码托管在云中是安全的,而宁愿维护内部网。 使您的存储库在本地Intranet中可用非常容易,但是要拥有一个与这些存储库进行交互的良好界面,从而使团队之间的协作变得更容易,并不是那么简单。

Git provides a web interface to solve this problem, gitweb, but it’s not an elegant and modern solution. It’s hard to see what has changed, who did it, and when it happened. Also, browsing through the working tree is cumbersome. There are other solutions available, but some are too hard to install or, again, hard on the eyes. I recently discovered GitList, a free and open source Git repository viewer. It’s interface resembles GitHub a lot but aims to keep everything simple and clear.

Git提供了一个解决该问题的Web界面gitweb,但这不是一个优雅而现代的解决方案。 很难看到发生了什么变化,发生了什么以及何时发生。 而且,浏览工作树很麻烦。 还有其他可用的解决方案,但是有些解决方案很难安装,或者很难看。 我最近发现了GitList,这是一个免费的开源Git存储库查看器 。 它的界面与GitHub非常相似,但旨在保持所有内容的简洁明了。

In this article I’ll guide you through the process of setting up your own Git repository viewer. Don’t worry, it won’t hurt and it’s quicker than installing WordPress!

在本文中,我将指导您完成设置自己的Git存储库查看器的过程。 不用担心,它不会受伤,而且比安装WordPress更快!

环境 (Environment)

For this guide I’m assuming that you are working on a Debian-based Linux distro, but GitList will work with anything. Basically, you need:

对于本指南,我假设您正在使用基于Debian的Linux发行版,但是GitList可以使用任何东西。 基本上,您需要:

  • Apache with mod_rewrite or Nginx

    使用mod_rewrite或Nginx的Apache
  • Git

    吉特
  • PHP 5.3+

    PHP 5.3以上

If you don’t have these installed, open a terminal and run:

如果没有安装这些工具,请打开终端并运行:

sudo apt-get update
sudo apt-get install php5 apache2 git

I’ll also make the following assumptions regarding your environment:

我还将对您的环境做出以下假设:

  • Path to your Git repositories: /home/bob/code

    Git存储库的路径: /home/bob/code

  • Path to Apache document root: /var/www

    Apache文档根目录的路径: /var/www

  • Path to Git executable: /usr/bin/git

    Git可执行文件的路径: /usr/bin/git

  • Your Apache root URL: http://localhost

    您的Apache根URL: http://localhost

Your Git repositories will be accessed by the Apache user, so you need to apply proper access permissions:

Apache用户将访问您的Git存储库,因此您需要应用适当的访问权限:

sudo chmod -R 744 /home/bob/code

安装和配置GitList (Installing and Configuring GitList)

First, download GitList. You can choose either the latest stable version or the master version, but keep in mind that the master version may have bugs since developers are actively working on it. After choosing your package, uncompress it to your Apache document root inside a folder called gitlist.

首先, 下载GitList 。 您可以选择最新的稳定版本,也可以选择主版本,但是请记住,由于开发人员正在积极使用主版本,因此主版本可能存在错误。 选择软件包后,将其解压缩到名为gitlist的文件夹中的Apache文档根目录。

Now to configure GitList! Rename the config.ini-example file to config.ini and open it with a text editor and make sure it looks like this:

现在配置GitList! 将config.ini-example文件重命名为config.ini ,并使用文本编辑器将其打开,并确保其外观如下:

[git]
client = '/usr/bin/git' ; Your git executable path
repositories = '/home/bob/code/' ; Path to your repositories

; You can hide repositories from GitList, just copy this for each repository you want to hide
; hidden[] = '/home/bob/code/SecretProject'

[app]
baseurl = 'http://localhost/gitlist' ; Base URL of the application

; If you need to specify custom filetypes for certain extensions, do this here
[filetypes]
; extension = type
; dist = xml

There’s just one step left: we have to create a folder inside /var/www/gitlist with the name cache and give it the proper permissions. So:

仅剩一步:我们必须在/var/www/gitlist内创建一个名称cache的文件夹,并为其赋予适当的权限。 所以:

cd /var/www/gitlist
mkdir cache
chmod 777 cache

Now go to http://localhost/gitlist and check it out.

现在转到http://localhost/gitlist并签出。

救命! 网页未找到! (Help! Page Not Found!)

GitList uses Apache’s mod_rewrite to create pretty URLs. So if the page isn’t found, make Apache has mod_rewrite enabled by running:

GitList使用Apache的mod_rewrite创建漂亮的URL。 因此,如果找不到该页面,请通过运行以下命令使Apache启用mod_rewrite:

sudo a2enmod rewrite

Also, make sure Apache is able to read the .htaccess file from the GitList directory. An .htaccess file is used for overriding and adding new rules to Apache directories. Open up your default Apache website config file (usually located in /etc/apache2/sites-enabled/000-default) and look for the following:

另外,请确保Apache能够从GitList目录读取.htaccess文件。 .htaccess文件用于覆盖和向Apache目录添加新规则。 打开默认的Apache网站配置文件(通常位于/etc/apache2/sites-enabled/000-default ),然后查找以下内容:


<Directory /var/www/>
	Options Indexes FollowSymLinks MultiViews
	AllowOverride None
	Order allow,deny
	allow from all
</Directory>

Change the AllowOverride option from None to All. Save your changes and restart Apache.

AllowOverride选项从None更改为All 。 保存更改,然后重新启动Apache。

sudo /etc/init.d/apache2 restart

客制化 (Customizing)

The GitList interface was built using Twitter Bootstrap and uses LESS. The LESS files are available under web/less. A makefile is provided, so all you have to do is customize the LESS files based on your taste, run make under the web directory, and the final CSS will be generated. Of course, you do have to have lessc installed, which can be done quite easily by running npm: npm install less

GitList接口是使用Twitter Bootstrap构建的,并使用LESS 。 LESS文件位于web/less 。 提供了一个makefile,因此您所要做的就是根据自己的喜好自定义LESS文件,在web目录下运行make ,然后将生成最终CSS。 当然,您确实必须安装lessc ,这可以通过运行npm轻松完成: npm install less

GitList is powered by the Twig template engine, and all templates are available under views. In order to understand what’s going on, I recommend you read this tutorial. Don’t forget to clean the contents of the cache folder after modifying .twig files!

GitList由Twig模板引擎提供动力,所有模板都可在views下使用。 为了了解正在发生的事情,建议您阅读本教程 。 修改.twig文件后,别忘了清理cache文件夹的内容!

Image via Fotolia

图片来自Fotolia

翻译自: https://www.sitepoint.com/installing-gitlist-for-local-repos/

maven 安装本地仓库

 类似资料: