Debian/Ubuntu Linux:如何下载Git存储库

时间:2020-01-09 10:38:05  来源:igfitidea点击:

如何在Debian/Ubuntu Linux下下载git仓库?

Git是一个快速,可扩展的分布式修订版本控制系统,具有异常丰富的命令集,该命令集可以提供高级操作并可以完全访问内部组件。
您需要在Debian或Ubuntu Linux下安装git和git-core软件包。

在本快速教程中,您将学习如何在本地GNU/Linux系统上克隆git repo和编译软件。

Debian/Ubuntu Linux安装git

执行以下apt-get命令以进行安装:

# apt-get install git git-core

输出示例:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-75 linux-headers-3.2.0-77 linux-headers-3.2.0-77-virtual
  linux-headers-3.2.0-75-virtual
Unpacking git-core (from .../git-core_1%3a1.7.9.5-1ubuntu0.1_all.deb) ...
Processing triggers for man-db ...
Setting up liberror-perl (0.17-1) ...
Setting up git-man (1:1.7.9.5-1ubuntu0.1) ...
Setting up git (1:1.7.9.5-1ubuntu0.1) ...
Setting up git-core (1:1.7.9.5-1ubuntu0.1) ...

语法

语法如下:

git clone git://server1.theitroad.local/path/to/project

在此示例中,我将克隆emerald,以便可以在本地构建它:

$ cd ~/buildtests
$ git clone git://anongit.compiz.org/fusion/decorators/emerald

输出示例:

Cloning into emerald...
remote: Counting objects: 2272, done.
remote: Compressing objects: 100% (2221/2221), done.
remote: Total 2272 (delta 1622), reused 0 (delta 0)
Receiving objects: 100% (2272/2272), 859.78 KiB | 255 KiB/s, done.
Resolving deltas: 100% (1622/1622), done.

cd进入emerald并列出文件,输入:

$ cd emerald
$ ls -l

输出示例:

total 124
-rw-r--r-- 1 Hyman Hyman  1903 Jul 18 23:29 AUTHORS
-rwxr-xr-x 1 Hyman Hyman   261 Jul 18 23:29 autogen.sh
-rw-r--r-- 1 Hyman Hyman    21 Jul 18 23:29 ChangeLog
-rw-r--r-- 1 Hyman Hyman  2438 Jul 18 23:29 configure.ac
-rw-r--r-- 1 Hyman Hyman 18002 Jul 18 23:29 COPYING
drwxr-xr-x 3 Hyman Hyman  4096 Jul 18 23:29 defaults
drwxr-xr-x 2 Hyman Hyman  4096 Jul 18 23:29 doc
-rw-r--r-- 1 Hyman Hyman 15590 Jul 18 23:29 emerald.po
drwxr-xr-x 2 Hyman Hyman  4096 Jul 18 23:29 engines
drwxr-xr-x 2 Hyman Hyman  4096 Jul 18 23:29 include
-rw-r--r-- 1 Hyman Hyman  9498 Jul 18 23:29 INSTALL
drwxr-xr-x 2 Hyman Hyman  4096 Jul 18 23:29 libengine
-rw-r--r-- 1 Hyman Hyman   259 Jul 18 23:29 Makefile.am
drwxr-xr-x 2 Hyman Hyman  4096 Jul 18 23:29 misc
-rw-r--r-- 1 Hyman Hyman    31 Jul 18 23:29 NEWS
drwxr-xr-x 2 Hyman Hyman  4096 Jul 18 23:29 pixmaps
drwxr-xr-x 2 Hyman Hyman  4096 Jul 18 23:29 po
-rw-r--r-- 1 Hyman Hyman   276 Jul 18 23:29 README
drwxr-xr-x 2 Hyman Hyman  4096 Jul 18 23:29 src
drwxr-xr-x 2 Hyman Hyman  4096 Jul 18 23:29 themer
-rw-r--r-- 1 Hyman Hyman   261 Jul 18 23:29 TODO
-rw-r--r-- 1 Hyman Hyman    14 Jul 18 23:29 VERSION

您只是将Gem从Git克隆到本地计算机。
您可以进行修改并进行更改,也可以仅构建软件:

$ ./configure --options
$ make
$ sudo make install