mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
after translation
This commit is contained in:
parent
9e738faeaf
commit
3797ef5f4f
@ -1,101 +0,0 @@
|
||||
How to Serve Git Repositories Using Gitblit Tool in Linux
|
||||
================================================================================
|
||||
Hi friends, today we'll be learning how to install Gitblit in your Linux Server or PC. So, lets check out what is a Git, its features and steps to install Gitblit. [Git is a distributed revision control system][1] with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. It was initially designed and developed by Linus Torvalds for Linux kernel under the terms of the GNU General Public License version 2 development in 2005, and has since become the most widely adopted version control system for software development.
|
||||
|
||||
[Gitblit is a free and open source][2] built on a pure Java stack designed to handle everything from small to very large projects with speed and efficiency for serving Git repositories. It is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
|
||||
|
||||
#### Features of Gitblit ####
|
||||
|
||||
- It can be used as a dumb repository viewer with no administrative controls or user accounts.
|
||||
- It can be used as a complete Git stack for cloning, pushing, and repository access control.
|
||||
- It can be used without any other Git tooling (including actual Git) or it can cooperate with your established tools.
|
||||
|
||||
### 1. Creating Gitblit install directory ###
|
||||
|
||||
First of all we'll gonna to create a directory in our server in which we'll be installing our latest gitblit in.
|
||||
|
||||
$ sudo mkdir -p /opt/gitblit
|
||||
|
||||
$ cd /opt/gitblit
|
||||
|
||||
![creating directory gitblit](http://blog.linoxide.com/wp-content/uploads/2015/01/creating-directory-gitblit.png)
|
||||
|
||||
### 2. Downloading and Extracting ###
|
||||
|
||||
Now, we will want to download the latest gitblit from the official site. Here, the current version of gitblit we are gonna install is 1.6.2 . So, please change it as the version you are gonna install in your system.
|
||||
|
||||
$ sudo wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz
|
||||
|
||||
![downloading gitblit package](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-gitblit.png)
|
||||
|
||||
Now, we'll be extracting our downloaded tarball package to our current folder ie /opt/gitblit/
|
||||
|
||||
$ sudo tar -zxvf gitblit-1.6.2.tar.gz
|
||||
|
||||
![extracting gitblit tar](http://blog.linoxide.com/wp-content/uploads/2015/01/extracting-gitblit-tar.png)
|
||||
|
||||
### 3. Configuring and Running ###
|
||||
|
||||
Now, we'll configure our Gitblit configuration. If you want to customize the behavior of Gitblit server, you can do it by modifying `gitblit/data/gitblit.properties` . Now, after you are done configuring the configuration. We finally wanna run our gitblit. We have two options on running gitblit, first is that we run it manually by the command below:
|
||||
|
||||
$ sudo java -jar gitblit.jar --baseFolder data
|
||||
|
||||
And next is to add and use gitblit as service. Here are the steps that we'll need to follow to use gitblit as service in linux.
|
||||
|
||||
So, As I am running Ubuntu, the command below will be sudo cp service-ubuntu.sh /etc/init.d/gitblit so please change the file name service-ubuntu.sh to the distribution you are currently running.
|
||||
|
||||
$ sudo ./install-service-ubuntu.sh
|
||||
|
||||
$ sudo service gitblit start
|
||||
|
||||
![starting gitblit service](http://blog.linoxide.com/wp-content/uploads/2015/01/starting-gitblit-service.png)
|
||||
|
||||
Open your browser to http://localhost:8080 or https://localhost:8443 or replace "localhost" with the ip-address of the machine depending on your system configuration. Enter the default administrator credentials: admin / admin and click the Login button.
|
||||
|
||||
![gitblit welcome](http://blog.linoxide.com/wp-content/uploads/2015/01/gitblit-welcome.png)
|
||||
|
||||
Now, we'll wanna add a new user. First you'll need to login to the admin with default administrator credentials: username = **admin** and password = **admin** .
|
||||
|
||||
Then, Goto user icon > users > (+) new user. And create a new user like as shown in the figure below.
|
||||
|
||||
![add new user](http://blog.linoxide.com/wp-content/uploads/2015/01/add-user.png)
|
||||
|
||||
Now, we'll create a new repo out of the box. Go to repositories > (+) new repository . Then, add new repository as shown below.
|
||||
|
||||
![add new repository](http://blog.linoxide.com/wp-content/uploads/2015/01/add-new-repository.png)
|
||||
|
||||
#### Create a new repository on the command-line ####
|
||||
|
||||
touch README.md
|
||||
git init
|
||||
git add README.md
|
||||
git commit -m "first commit"
|
||||
git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git
|
||||
git push -u origin master
|
||||
|
||||
Please replace the username arunlinoxide with the user you add.
|
||||
|
||||
#### Push an existing repository from the command-line ####
|
||||
|
||||
git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git
|
||||
git push -u origin master
|
||||
|
||||
**Note**: It is highly recommended to everyone to change the password of username "admin" as it comes by default.
|
||||
|
||||
### Conclusion ###
|
||||
|
||||
Hurray, we finally installed our latest Gitblit in our Linux Computer. We can now enjoy such a beautiful version controlling system for our projects whether its small or large, no matter. With Gitblit, version controlling has been too easy. It is easy to learn and has a tiny footprint with lightning fast performance. So, if you have any questions, suggestions, feedback please write them in the comment box below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/linux-how-to/serve-git-repositories-gitblit/
|
||||
|
||||
作者:[Arun Pyasi][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/arunp/
|
||||
[1]:http://git-scm.com/
|
||||
[2]:http://gitblit.com/
|
@ -0,0 +1,101 @@
|
||||
如何在Linux下使用Gitblit工具创建Git仓库服务
|
||||
================================================================================
|
||||
嗨!朋友,今天我们将学习如何在你的Linux服务器或者PC上安装Gitblit工具。首先,我们看看什么是Git,它的功能以及安装Gitblit的步骤。[Git是分布式版本控制系统][1],它强调速度、数据一致性,并且支持分布式、非线性工作流。它最初由Linus Torvalds在2005年为Linux内核设计和开发,使用GPL2证书,并因此成为软件开发中使用最广泛的版本控制系统。
|
||||
|
||||
[Gitblit是完全开源的软件][2],它基于纯粹的Java堆栈,被设计以在Git仓库速度和效率方面胜任从小型到极大型的项目。它很容易学习和上手,并有着闪电般的性能。它在廉价的本地分支、便于staging、多工作流等方面远胜过一些SCM(版本控制)工具,比如Subversion、CVS、Perforce和ClearCase。
|
||||
|
||||
#### Gitblit的功能 ####
|
||||
|
||||
- 它可以做为一个无声的仓库视图,没有管理控制以及用户账户。
|
||||
- 它可以做为完整的Git堆栈,拥有clone, pushing和仓库存取控制。
|
||||
- 它能独立于其他Git工具使用(包括实际的Git),它能和您已创建的工具合作。
|
||||
|
||||
### 1.创建Gitblit安装目录 ###
|
||||
|
||||
首先我们将在我们的服务器上建立一个目录,我们将在该目录下安装最新的Gitblit。
|
||||
|
||||
$ sudo mkdir -p /opt/gitblit
|
||||
|
||||
$ cd /opt/gitblit
|
||||
|
||||
![创建gitblit目录](http://blog.linoxide.com/wp-content/uploads/2015/01/creating-directory-gitblit.png)
|
||||
|
||||
### 2. 下载并解压 ###
|
||||
|
||||
现在,我们将从Gitblit官方站点下载最新版的Gitblit。这里我们将安装1.6.2版本。所以,请在安装时根据具体的版本对命令进行修改。
|
||||
|
||||
$ sudo wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz
|
||||
|
||||
![下载gitblit安装包](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-gitblit.png)
|
||||
|
||||
接下来,我们将解压下载到的tarball压缩包至之前创建的目录 /opt/gitblit/
|
||||
|
||||
$ sudo tar -zxvf gitblit-1.6.2.tar.gz
|
||||
|
||||
![解压gitblit压缩包](http://blog.linoxide.com/wp-content/uploads/2015/01/extracting-gitblit-tar.png)
|
||||
|
||||
### 3.配置并运行 ###
|
||||
|
||||
现在,我们将对Gitblit进行配置。如果你想要定制Gitblit的行为,你可以修改`gitblit/data/gitblit.properties`。在完成配置后,我们将运行安装好的gitblit。有两种方式来运行gitblit,第一种是通过下面的命令手动运行:
|
||||
|
||||
$ sudo java -jar gitblit.jar --baseFolder data
|
||||
|
||||
另一种是将gitblit添加为服务。下面是在linux下将gitblit添加为服务的步骤。
|
||||
|
||||
由于我在使用Ubuntu,下面的命令将是 sudo cp service-ubuntu.sh /etc/init.d/gitblit。所以请根据你的发行版修改文件名service-ubuntu.sh为相应的你运行的发行版。
|
||||
|
||||
$ sudo ./install-service-ubuntu.sh
|
||||
|
||||
$ sudo service gitblit start
|
||||
|
||||
![启动gitblit服务](http://blog.linoxide.com/wp-content/uploads/2015/01/starting-gitblit-service.png)
|
||||
|
||||
在你的浏览器中打开http://localhost:8080或https://localhost:8443,也可以将localhost根据本地配置替换为IP地址。输入默认的管理员凭证:admin/admin并点击login按钮。
|
||||
|
||||
![gitblit欢迎页面](http://blog.linoxide.com/wp-content/uploads/2015/01/gitblit-welcome.png)
|
||||
|
||||
现在,我们将添加一个新的用户。首先,你需要以admin用户登录,username = **admin**,password = **admin**。
|
||||
|
||||
然后,点击 user icon > users > (+) new user 来创建一个新用户,如下图所示。
|
||||
|
||||
![添加新用户](http://blog.linoxide.com/wp-content/uploads/2015/01/add-user.png)
|
||||
|
||||
现在,我们将创建一个开箱可用的仓库。点击 repositories > (+) new repository。然后,如下图所示添加新的仓库。
|
||||
|
||||
![添加新的仓库](http://blog.linoxide.com/wp-content/uploads/2015/01/add-new-repository.png)
|
||||
|
||||
#### 使用命令行创建一个新的仓库 ####
|
||||
|
||||
touch README.md
|
||||
git init
|
||||
git add README.md
|
||||
git commit -m "first commit"
|
||||
git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git
|
||||
git push -u origin master
|
||||
|
||||
请将用户名arunlinoxide替换为你添加的用户名。
|
||||
|
||||
#### 在命令行中push一个已存在的仓库 ####
|
||||
|
||||
git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git
|
||||
git push -u origin master
|
||||
|
||||
**注意**:强烈建议所有人修改用户名“admin”的密码。
|
||||
|
||||
### 结论 ###
|
||||
|
||||
欢呼吧!我们已经在Linux电脑中安装好了最新版本的Gitblit。接下来我们便可以在我们的大小工程中享受这样一个优美的版本控制系统。有了Gitblit,版本控制便再容易不过了。它有易于学习、轻量级、高性能的特点。因此,如果你有任何的问题、建议和反馈,请在留言处留言。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/linux-how-to/serve-git-repositories-gitblit/
|
||||
|
||||
作者:[Arun Pyasi][a]
|
||||
译者:[wwy-hust](https://github.com/wwy-hust)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://linoxide.com/author/arunp/
|
||||
[1]:http://git-scm.com/
|
||||
[2]:http://gitblit.com/
|
Loading…
Reference in New Issue
Block a user