在Ubuntu搭建Git

简介: 在Ubuntu搭建Git Git是一个开源的分布式版本控制系统,它在全球范围内得到广泛的使用。互联网上还有像GitHub这样的网站提供了免费的Git服务,很多流行的开源项目都使用了Git来托管项目,比如Perl、Ruby on Rails、Linux内核项目等。

在Ubuntu搭建Git

Git是一个开源的分布式版本控制系统,它在全球范围内得到广泛的使用。互联网上还有像GitHub这样的网站提供了免费的Git服务,很多流行的开源项目都使用了Git来托管项目,比如Perl、Ruby on Rails、Linux内核项目等。 

在Ubuntu系统上安装Git的最佳方式是使用Ubuntu软件仓库提供的软件包,这些软件包都是经过了充分测试的,已经完成了预编译,安装或卸载都非常方便。 
下面我们将在线更新服务器上的软件仓库索引,保证安装的Git服务器是比较新的稳定版。

1、升级系统并更新库索引

# apt-get update
# apt-get upgrade 

2、安装Git服务

完成了更新操作后,就可以开始安装Git服务了。

# apt-get install git-core
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  git git-man liberror-perl
Suggested packages:
  git-daemon-run git-daemon-sysvinit git-doc git-el git-arch
  git-cvs git-svn git-email git-gui gitk gitweb
The following NEW packages will be installed:
  git git-core git-man liberror-perl
0 upgraded, 4 newly installed, 0 to remove and 100 not upgraded.
Need to get 6,752 kB of archives.
After this operation, 15.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://cn.archive.ubuntu.com/ubuntu/ precise/main liberror-perl all 0.17-1 [23.8 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main git-man all 1:1.7.9.5-1ubuntu0.1 [631 kB]
Get:3 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main git amd64 1:1.7.9.5-1ubuntu0.1 [6,097 kB]
Get:4 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main git-core all 1:1.7.9.5-1ubuntu0.1 [1,380 B]
Fetched 6,752 kB in 1s (3,712 kB/s)   
Selecting previously unselected package liberror-perl.
(Reading database ... 51734 files and directories currently installed.)
Unpacking liberror-perl (from .../liberror-perl_0.17-1_all.deb) ...
Selecting previously unselected package git-man.
Unpacking git-man (from .../git-man_1%3a1.7.9.5-1ubuntu0.1_all.deb) ...
Selecting previously unselected package git.
Unpacking git (from .../git_1%3a1.7.9.5-1ubuntu0.1_amd64.deb) ...
Selecting previously unselected package git-core.
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) ... 

3、基本的配置

一旦完成以上安装过程,就该进行Git服务的配置。最基本的配置是这样的:

# git config --global user.name "jieforest"
# git config --global user.email jieforest@chinaunix.net 

可以根据自己的实际,替换用户名和密码。

目录
相关文章
|
4月前
|
Ubuntu Linux 开发工具
Linux Ubuntu配置Git的方法
Linux Ubuntu配置Git的方法
|
Ubuntu 开发工具 git
UBUNTU上新建GIT库
UBUNTU上新建GIT库
63 0
|
存储 Ubuntu
Ubuntu用Apache2快速搭建一个HTTP文件服务器
Ubuntu用Apache2快速搭建一个HTTP文件服务器
418 0
|
网络协议 Ubuntu 安全
ubuntu22.04 打开工作新局面【git加速、手机连通、git配置】
ubuntu22.04 打开工作新局面【git加速、手机连通、git配置】
1016 0
ubuntu22.04 打开工作新局面【git加速、手机连通、git配置】
|
Shell 开发工具 数据安全/隐私保护
Git之使用GitHub搭建远程仓库
我们需要一个作为服务器的远程仓库!当然搭建一个服务器是需要成本的,为什么不把项目托管到Github上呢?作为开源代码库以及版本控制系统,Github拥有140多万开发者用户。随着越来越多的应用程序转移到了云上,Github已经成为了管理软件开发以及发现已有代码的首选方法,不需要任何成本,为何不使用呢?本节就来学习如何把我们的代码托管到Github上!
200 0
|
应用服务中间件 开发工具 nginx
搭建自用git服务器
搭建自用git服务器
264 0
搭建自用git服务器
|
Ubuntu 安全
Ubuntu 20.04 搭建NFS文件系统
Ubuntu 20.04 搭建NFS文件系统
243 0
|
Linux 开发工具 数据安全/隐私保护
Linux搭建Git服务器
Linux搭建Git服务器
Linux搭建Git服务器
|
算法 安全 Shell
使用Gitolite搭建Git服务器
Git 服务的管理工具,主要有如下几种。 Gitosis- 轻量级, 开源项目,使用 SSH 公钥认证,只能做到库级的权限控制。目前项目已经停止开发,不再维护。 Gitolite - 轻量级,开源项目
414 0
使用Gitolite搭建Git服务器
|
Ubuntu 安全 Shell
搭建Git服务器
本文参考于廖雪峰老师的博客Git 教程。依照其博客进行学习和记录,感谢其无私分享,也欢迎各位查看原文。 新用户家(home)目录下.shh/authorized_keys存放管理连接到 Git 远程仓
260 0
搭建Git服务器