ubuntu离线搭建gitlab服务器
‘壹’ 系里要搭建gitlab服务器。我在我的电脑上安装好gitlab。发现自己可以连上。但是用舍友的电脑却连不上。
你说的在浏览器里浏览不了,还是代码clone不下来?如果是前者,就是网的问题,如果是后者,就是ssh公钥或者ip的问题,你可以具体说下
‘贰’ 如何在ubuntu server 14.04下安装gitlab中文版
安装步骤有:
1. 依赖包
2. ruby
3. 用户创建
4. 数据库初始化
5. redis
6. gitlab源码
7. apache
本文可能会用到VPN连接,在命令行下创建VPN连接的方法如下:
sudo apt-get install pptp-linux
sudo pptpsetup --create VPN名称 --server 服务器地址 --username 用户名 --password 密码 [--encrypt] --start
以上命令会创建一个设备,如果没有其他的拨号设备,这个设备会是ppp0,用ifconfig可以看到,“--encrypt”选项可选,因为有的服务器不支持,会提示MPPE required but peer negotiation failed,创建时带上“--start”选项可以看到连接的情况。
pptpsetup创建的VPN连接重启后会失效,如果想在不重启的情况下删除VPN连接:
sudo pptpsetup --delete VPN名称
创建VPN连接后还需要使能,并且添加到路由列表:
sudo pon VPN名称
sudo route add default dev ppp0
禁用VPN连接的方法是:
sudo poff VPN名称
下面开始正文:
1. 依赖包
我装的是ubuntu server 14.04,安装的时候可以选是否安装LAMP(Linux+Apache+Mysql+PHP),如果没装,可以用下面的命令装:
sudo tasksel install lamp-server
安装的时候会提示输入MySQL的root密码,下面要用。
接下来是依赖关系:
sudo apt-get install flex bison ruby build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake libkrb5-dev nodejs git-core
注意:这里面装了ruby,应该是1.9.1版本的,gitlab需要2.0以上的ruby,但是安装2.0以上的ruby需要低版本的ruby,所以我们先装上,一会儿卸掉。另外,ubuntu 14.04的软件库里有ruby 2.0,但是实测不能用,所以还是从源码装ruby吧。
2. ruby
下载,编译,安装(安装前删掉ruby 1.9.1):
curl -L --progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz | tar xz
cd ruby-2.1.5
./configure --prefix=/usr --disable-install-rdoc
make
sudo apt-get autoremove ruby
sudo make install
然后安装bundler:
sudo gem install bundler --no-ri --no-rdoc
3. 用户创建
为gitlab创建一个git用户:
sudo adser --disabled-login --gecos 'GitLab' git
4. 数据库初始化
官方指南用的是PostgreSQL,不过官方也有MySQL的说明:
http://doc.gitlab.com/ce/install/database_mysql.html
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
mysql -u root -p
输入MySQL的root密码登陆,然后:
mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password';
记得把上面这句的"$password"换成实际的密码,然后:
mysql> SET storage_engine=INNODB;
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_proction` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_proction`.* TO 'git'@'localhost';
mysql> \q
5. Redis
Redis貌似是用来存key的数据库吧,不知道,反正按步骤安装:
sudo apt-get install redis-server
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
sed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf
echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf
echo 'unixsocketperm 770' | sudo tee -a /etc/redis/redis.conf
sudo service redis-server restart
sudo usermod -aG redis git
6. gitlab源码
gitlab源码默认是安装在/home/git/gitlab,如果要更改,请参照官方手册。获取中文版源码的过程如下:
cd /home/git
sudo -u git -H git clone https://gitlab.com/larryli/gitlab.git
不知道是因为GFW还是什么,git clone这个版本库可慢可慢了,我用了VPN,速度会快点。
git clone完以后可以checkout你想要的版本,在本文编写的时间(2015年4月22日),可以:
sudo -u git -H git checkout 7-7-zh
然后配置源码
cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX,go-w log/
sudo chmod -R u+rwX tmp/
sudo -u git -H mkdir /home/git/gitlab-satellites
sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/
sudo chmod -R u+rwX public/uploads
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "[email protected]"
sudo -u git -H git config --global core.autocrlf input
sudo -u git -H cp config/resque.yml.example config/resque.yml
当然,你可以把[email protected]改成你的email;上面的那些yml文件里面的配置基本都不用更改;然后,配置数据库用户名和密码:
sudo -u git cp config/database.yml.mysql config/database.yml
sudo -u git -H editor config/database.yml
sudo -u git -H chmod o-rwx config/database.yml
然后,安装gems:
sudo -u git -H bundle install --deployment --without development test postgres aws
这一步必须使用VPN,因为万恶的GFW屏蔽了rubygems.org,所以会提示connection reset by peer之类的,这部时间也会比较久,如果你的机器是多核的,也可以加上和make相同-jN参数,N等于核数。
(2015年5月2日追加)
发现淘宝做了个rubygrems.org的国内镜像,http://ruby.taobao.org/,可以参照上面的内容设置,加快gems安装速度。
再接下来安装gitlab shell:
sudo -u git -H bundle exec rake gitlab:shell:install[v2.6.0] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=proction
sudo -u git -H editor /home/git/gitlab-shell/config.yml
把gitlab的url改成http://localhost/或者你的域名。
在接下来初始化数据库:
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=proction
加入启动项:
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo update-rc.d gitlab defaults 21
初始化日志:
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
检查应用状态:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=proction
编译附件:
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=proction
启动gitlab服务:
sudo service gitlab start
7. apache
下载apache的配置文件:https://gitlab.com/gitlab-org/gitlab-recipes/blob/master/web-server/apache/gitlab-apache2.4.conf
将其中的“ProxyPassReverse
http://gitlab.example.com/”改成“ProxyPassReverse
http://localhost/”或者你的域名,将其中的“/var/log/httpd/logs/”改为“/var/log/apache2/”。
用命令来说:
wget https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/web-server/apache/gitlab-apache2.4.conf
mv gitlab-apache2.4.conf 001-gitlab.conf
editor 001-gitlab.conf (进行上述修改)
sudo cp 001-gitlab.conf /etc/apache2/sites-available
cd /etc/apache2/sites-enabled
sudo rm 000-default.conf
sudo ln -s ../sites-available/001-gitlab.conf 001-gitlab.conf
另外,还需要使能代理模块以实现反向代理功能,不然会提示“ProxyPassReverse”无效之类的。
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/proxy.conf proxy.conf
sudo ln -s ../mods-available/proxy.load proxy.load
sudo ln -s ../mods-available/proxy_connect.load proxy_connect.load
sudo ln -s ../mods-available/proxy_http.load proxy_http.load
sudo ln -s ../mods-available/rewrite.load rewrite.load
重启apache:
sudo service apache2 restart
然后,检查下配置是否正确:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=proction
如果都是绿色的结果,那就可以访问了。登陆用户名:root,初始密码:5iveL!fe
最后配置一下邮件,修改/home/git/gitlab/config/gitlab.yml,里面的“email_from:”为一个有效的email地址;修改/home/git/gitlab/config/environments/proction.rb,里面的 “config.action_mailer.delivery_method=”为“:smtp”;最后:
cd /home/git/gitlab/config/initializers
sudo -u git -H cp smtp_settings.rb.sample smtp_settings.rb
然后把文件的里的内容修改正确了,再重启一下gitlab服务就行了:
sudo service gitlab restart
‘叁’ gitlab 在内网服务器,怎么使用
ubuntu 13/pub/ruby/1/gitlabhq/gitlab-shell/',本地局域网安装的话默认localhost就行/gitlabhq/gitlabhq.git gitlab# 进入 gitlab 目录cd /home/git/gitlab# 切换到 gitlab 的 5.3 分支.sudo -u git -H git checkout 5-3-stablecd /home/git/gitlab# 复制 gitlab 的示例配置文件到指定目录sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml# 如果用的不是本地服务器,更改 localhost 为 gitlab 的服务器域名sudo -u git -H gedit config/gitlab.yml# 确保当前用户对 gitlab 的 log 和 tmp 文件有读写权限.sudo chown -R git log/sudo chown -R git tmp/sudo chmod -R u+rwX log/sudo chmod -R u+rwX tmp/# 创建一个我不认识的目录...汗!sudo -u git -H mkdir /home/git/gitlab-satellites# 再创建两个我不认识的目录...并且确保 当前用户对他有读写权限.sudo -u git -H mkdir tmp/pids/sudo -u git -H mkdir tmp/sockets/sudo chmod -R u+rwX tmp/pids/sudo chmod -R u+rwX tmp/sockets/# 创建公共的上传备份目录,并确保当前用户对其有读写权限.否则备份会失败.sudo -u git -H mkdir public/uploadssudo chmod -R u+rwX public/uploads# 复制示例配置文件到制定目录sudo -u git -H cp config/puma.rb.example config/puma.rb# 找到其中有一行 # workers 2,去掉前面的 # 并将 2 改为 3.sudo -u git -H gedit config/puma.rb# 配置 gitlab 的全局设置.sudo -u git -H git config --global user.name GitLabsudo -u git -H git config --global user.email gitlab@localhost# 复制示例Mysql配置文件到指定目录sudo -u git cp config/database.yml.mysql config/database.yml# 修改里面的 root 为 gitlab, 密码为创建的 gitlab mysql 用户密码sudo gedit config/database.yml# 安装一个我不认识的东西...我没脸翻译了...大哥你还是看原版教程吧cd /home/git/gitlabsudo gem install charlock_holmes --version '0.6.9.4'sudo -u git -H bundle install --deployment --without development test postgressudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=proction# 下载 gitlab 的 开始/停止 脚本,并且加入当前用户的可执行权限.sudo cp lib/support/init.d/gitlab /etc/init.d/gitlabsudo chmod +x /etc/init.d/gitlab# 添加 gitlab 的开机启动sudo update-rc.d gitlab defaults 21# 检查 gitlab 的状态和环境配置是否正确.sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=proction# 启动 gitlabsudo service gitlab start# 或者sudo /etc/init.d/gitlab restart# 再次检查 gitlab 的状态,如果全部绿色,说明 gitlab 配置成功.不知道为什么,我要运行这个命令两次才会全绿sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=proction七. 配置 Nginx# 软件源安装Nginxsudo apt-get install nginx# 复制 gitlab 的示例配置到指定目录sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlabsudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab# 修改配置文件.更改其中的 YOUR_SERVER_FQDN 为你的 gitlab 服务器全称域名或者本机IP地址,修改 listen 为 *:80sudo gedit /etc/nginx/sites-available/gitlab# 重启 nginx 服务器sudo service nginx restart# 打开浏览器输入本机 IP,用下面的用户密码登录既可[email protected]!fe
‘肆’ ubuntu搭建gitlab服务器,执行 gitlab-ctl reconfigure,显示chef client failed。
原因:ubuntu14.04版本应该是 trusty 版本,而下载的gitlab软件包却是 xenial版本的
解决:下载trusty版本的 gitlab 进行安装
查看ubuntu版本的方法:
root@kickseed:~# lsb_release -a
No LSB moles are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
‘伍’ 如何在 Ubuntu/Fedora/Debian 中安装 GitLab
1. 安装先决条件
首先,我们需要安装 GitLab 所依赖的软件包。我们将安装 curl,用以下载我们所需的文件;安装openssh-server ,以此来通过 ssh 协议登录到我们的机器上;安装ca-certificates,用它来添加 CA 认证;以及 postfix,把它作为一个 MTA(Mail Transfer Agent,邮件传输代理)。
注: 若要安装 GitLab 社区版,我们需要一个至少包含 2 GB 内存和 2 核 CPU 的 linux 机器。
在 Ubuntu 14 .04/Debian 8.x 中
鉴于这些依赖包都可以在 Ubuntu 14.04 和 Debian 8.x 的官方软件仓库中获取到,我们只需通过使用 apt-get 包管理器来安装它们。为此,我们需要在一个终端或控制台中执行下面的命令:
#apt-get install curl openssh-server ca-certificates postfix
install dependencies gitlab ubuntu debian
在 Fedora 22 中
在 Fedora 22 中,由于 yum 已经被弃用了,默认的包管理器是 dnf。为了安装上面那些需要的软件包,我们只需运行下面的 dnf 命令:
# dnf install curl openssh-server postfix
install dependencies gitlab fedora
2. 打开并开启服务
现在,我们将使用我们默认的初始化系统来打开 sshd 和 postfix 服务。并且我们将使得它们在每次系统启动时被自动开启。
在 Ubuntu 14.04 中
由于在 Ubuntu 14.04 中安装的是 SysVinit 初始化系统,我们将使用 service 命令来开启 sshd 和 postfix 守护进程:
# service sshd start
# service postfix start
现在,为了使得它们在每次开机启动时被自动开启,我们需要运行下面的 update-rc.d 命令:
# update-rc.d sshd enable
# update-rc.d postfix enable
在 Fedora 22/Debian 8.x 中
鉴于 Fedora 22 和 Debian 8.x 已经用 Systemd 代替了 SysVinit 来作为默认的初始化系统,我们只需运行下面的命令来开启 sshd 和 postfix 服务:
#systemctl start sshd postfix
现在,为了使得它们在每次开机启动时可以自动运行,我们需要运行下面的 systemctl 命令:
#systemctl enable sshd postfix
Created symlink from/etc/systemd/system/multi-user.target.wants/sshd.service to /usr/lib/systemd/system/sshd.service.
Created symlink from/etc/systemd/system/multi-user.target.wants/postfix.service to /usr/lib/systemd/system/postfix.service.
3. 下载 GitLab
现在,我们将使用 curl 从官方的 GitLab 社区版仓库下载二进制安装文件。首先,为了得到所需文件的下载链接,我们需要浏览到该软件仓库的页面。为此,我们需要在运行着相应操作系统的 linux 机器上运行下面的命令。
在 Ubuntu 14.04 中
由于 Ubuntu 和 Debian 使用相同的 debian 格式的安装包,我们需要在 https://packages.gitlab.com/gitlab/gitlab-ce?filter=debs 下搜索所需版本的 GitLab,然后点击有着 ubuntu/trusty 标签的链接,即我们运行着的 Ubuntu 14.04。接着一个新的页面将会出现,我们将看到一个下载按钮,然后我们在它的上面右击,得到文件的链接,然后像下面这样使用 curl 来下载它。
# curl https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/trusty/gitlab-ce_8.1.2-ce.0_amd64.deb
Downloading Gitlab Ubuntu
在 Debian 8.x 中
与 Ubuntu 类似,我们需要在 https://packages.gitlab.com/gitlab/gitlab-ce?filter=debs 页面中搜索所需版本的 GitLab,然后点击带有 debian/jessie 标签的链接,即我们运行着的 Debian 8.x。接着,一个新的页面将会出现,然后我们在下载按钮上右击,得到文件的下载链接。最后我们像下面这样使用 curl 来下载该文件。
# curl https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/jessie/gitlab-ce_8.1.2-ce.0_amd64.deb/download
Downloading Gitlab Debian
在 Fedora 22 中
由于 Fedora 使用 rpm 文件来作为软件包,我们将在 https://packages.gitlab.com/gitlab/gitlab-ce?filter=rpms 页面下搜索所需版本的 GitLab,然后点击所需发行包的链接,这里由于我们运行的是 Fedora 22,所以我们将选择带有 el/7 标签的发行包。一个新的页面将会出现,在其中我们可以看到一个下载按钮,我们将右击它,得到所需文件的链接,然后像下面这样使用 curl 来下载它。
# curl https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-8.1.2-ce.0.el7.x86_64.rpm/download
Downloading Gitlab Fedora
4. 安装 GitLab
在相应的软件源被添加到我们的 linux 机器上之后,现在我们将使用相应 linux 发行版本中的默认包管理器来安装 GitLab 社区版。
在 Ubuntu 14.04/Debian 8.x 中
要在运行着 Ubuntu 14.04 或 Debian 8.x linux 发行版本的机器上安装 GitLab 社区版,我们只需运行如下的命令:
# dpkg -i gitlab-ce_8.1.2-ce.0_amd64.deb
Installing Gitlab Ubuntu Debian
在 Fedora 22 中
我们只需执行下面的 dnf 命令来在我们的 Fedora 22 机器上安装 GitLab。
# dnf install gitlab-ce-8.1.2-ce.0.el7.x86_64.rpm
Installing Gitlab Fedora
5. 配置和开启 GitLab
GitLab 社区版已经成功地安装在我们的 linux 系统中了,接下来我们将要配置和开启它了。为此,我们需要运行下面的命令,这在 Ubuntu、Debian 和 Fedora 发行版本上都一样:
# gitlab-ctl reconfigure
Reconfiguring Gitlab
6. 允许通过防火墙
假如在我们的 linux 机器中已经启用了防火墙程序,为了使得 GitLab 社区版的 web 界面可以通过网络进行访问,我们需要允许 80 端口通过防火墙,这个端口是 GitLab 社区版的默认端口。为此,我们需要运行下面的命令。
在 iptables 中
Ubuntu 14.04 默认安装和使用的是 iptables。所以,我们将运行下面的 iptables 命令来打开 80 端口:
# iptables -A INPUT -p tcp -m tcp --dport 80-j ACCEPT
# /etc/init.d/iptables save
在 firewalld 中
由于 Fedora 22 和 Debian 8.x 默认安装了 systemd,它包含了作为防火墙程序的 firewalld。为了使得 80 端口(http 服务) 能够通过 firewalld,我们需要执行下面的命令。
# firewall-cmd --permanent --add-service=http
success
# firewall-cmd --reload
success
7. 访问 GitLab Web 界面
最后,我们将访问 GitLab 社区版的 web 界面。为此,我们需要将我们的 web 浏览器指向 GitLab 服务器的网址,根据我们的配置,可能是 http://ip-address/ 或 http://domain.com/ 的格式。在我们成功指向该网址后,我们将会看到下面的页面。
Gitlab Login Screen
现在,为了登录进面板,我们需要点击登录按钮,它将询问我们的用户名和密码。然后我们将输入默认的用户名和密码,即 root 和 5iveL!fe 。在登录进控制面板后,我们将被强制要求为我们的 GitLab root 用户输入新的密码。
Setting New Password Gitlab
8. 创建仓库
在我们成功地更改密码并登录到我们的控制面板之后,现在,我们将为我们的新项目创建一个新的仓库。为此,我们需要来到项目栏,然后点击 新项目 绿色按钮。
Creating New Projects
接着,我们将被询问给我们的项目输入所需的信息和设定,正如下面展示的那样。我们甚至可以从其他的 git 仓库提供商和仓库中导入我们的项目。
Creating New Project
做完这些后,我们将能够使用任何包含基本 git 命令行的 Git 客户端来访问我们的 Git 仓库。我们可以看到在仓库中进行的任何活动,例如创建一个里程碑,管理问题,合并请求,管理成员,便签,Wiki 等。
Gitlab Menu
总结
GitLab 是一个用来管理 git 仓库的很棒的开源 web 应用。它有着漂亮的带有诸多酷炫功能的响应式界面。它还打包有许多酷炫功能,例如管理群组,分发密钥,持续集成,查看日志,广播消息,钩子,系统 OAuth 应用,模板等。(注:OAuth 是一个开放标准,允许用户让第三方应用访问该用户在某一网站上存储的私密的资源(如照片,视频,联系人列表),而无需将用户名和密码提供给第三方应用。--- 摘取自 维基网络上的 OAuth 词条) 它还可以和大量的工具进行交互如 Slack,Hipchat,LDAP,JIRA,Jenkins,有很多类型的钩子和完整的 API。它至少需要 2 GB 的内存和 2 核 CPU 来流畅运行,支持多达 500 个用户,但它也可以被扩展到多个工作服务器上。
‘陆’ 怎样在ubuntu下搭建topic git(topgit)服务器
可以参考这个文章
http://www.oschina.net/question/54100_19781
另外,topgit是基于git的插件,不存在服务器的问题,要在ubuntu下安装git服务器,可以使用gitlab,支持http和ssh
‘柒’ 自己搭建的gitlab服务器,中文显示就乱码。
就需要使用ssh-keygen上传公钥,使用非对称加密传输。下面讲述如何上传你的ssh公钥... 3.1.2保存sshkey到gitlab 在面板上依次点击Profile Settings – SSH Keys – Add SSH K
‘捌’ 怎么在win10下访问搭建在ubuntu上的gitlab服务器
GitLab是由Ruby语言开发的基于Linux的Git服务器,是我见过的最强大的Git服务器。发现它之后,立即决定将Git服务器换成GitLab。但安装好GitLab之后面临一个问题,如何将服务器上的git项目直接导入到GitLab,之前的Git服务器是由是git+apache搭建的(详见在Linux上用Apache搭建Git服务器)。
在网上发现了这篇文档——Import bare repositories into your GitLab instance,并按之进行了操作。
1)设置存放代码库的主目录
vi /etc/gitlab/gitlab.rb
比如这里设置为:git_data_dir "/gitlab/repos"
2)访问刚搭建的GitLab站点,创建一个group,比如cnblogs。
这时会在 /gitlab/repos 下创建 /gitlab/repos/repositories/cnblogs 文件夹。
然后在/gitlab/repos/repositories/创建一个文件夹,比如cnblogs
3)将现有的所有git项目文件复制到这个文件夹
cp -r /data/git/* /gitlab/repos/repositories/cnblogs
4)修改一下复制过来的文件夹的所有者:
chown -R git:git /gitlab/repos/repositories/cnblogs
5)运行GitLab导入命令
cd /var/opt/gitlab
gitlab-rake gitlab:import:repos
等了一段时间之后,显示done,却一个项目也没导入进来。
经研究发现,在导入时,GitLab只认文件夹名以.git结尾的项目。于是,将要导入的项目文件夹名称加上.git后缀,再次进行导入。
结果显示导入成功,比如:
Processing cnblogs/CNBlogsJob.git
* Created CNBlogsJob (cnblogs/CNBlogsJob.git)
Done!
可以是GitLab站点上却看不到已导入的项目。多次努力,也没能解决这个问题。
后来,实在没办法,改为手动导入,导入方法如下:
1)在GitLab站点上创建与要导入的项目同名的项目。
2)进入刚创建的项目文件夹
cd /gitlab/repos/repositories/cnblogs/项目名称.git
3)删除该文件下的所有文件
rm -rf *
4)将要导入的项目文件夹下的所有文件复制过来
cp -r /data/git/CNBlogsJob/* /gitlab/repos/repositories/cnblogs/CNBlogsJob.git
就这样将项目一个一个地导入进来。
5)导入完成后,修改一下导入的所有项目的文件所有者
chown -R git:git /gitlab/repos/repositories/cnblogs
如果不修改所有者,客户端无法进行git push。
就这样手动地完成了现有Git项目的导入。
备注:操作系统是CentOS 6.2,GitLab版本是7.8.4。
‘玖’ git服务器端有几种办法
Git 可以使用四种主要的协议来传输数据:本地传输,SSH 协议,Git 协议和 HTTP 协议。
Git是一个开源的分布式版本控制系统,可以有效、高速地处理从很小到非常大的项目版本管理。
Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。
Git的主要功能:
1. 检查电子邮件或其他方式来检查提交状态的平均开发人员。
2. 修补程序并解决冲突(您自己或要求开发人员稍后重新提交它,如果它是一个开源项目,请确定哪些修补程序可以工作,哪些不能)。
3.将结果提交到公共服务器,然后通知所有开发人员。
(9)ubuntu离线搭建gitlab服务器扩展阅读:
Git的优缺点:
优点:
1. 适合分布式开发,强调个人。
2. 公共服务器压力和数据量不是太大。
3.快速和灵活。
4.任何两个开发人员之间的冲突都可以很容易地解决。
5. 离线工作。
缺点:
1. 数据很少(至少是中文)。
2. 学习周期相对较长。
3.不符合传统思维。
4. 可怜的代码的机密性。一旦开发人员克隆了整个库,所有代码和版本信息都可以完全公开。