我安装成功时版本:
gitlab:7.3
nginx:1.4.5
postgresql:9.3.0
ruby:2.3
https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md
Installation
Select Version to Install
Make sure you view this installation guide from the branch (version) of GitLab you would like to install. In most cases this should be the highest numbered stable branch (example shown below).
If the highest number stable branch is unclear please check the GitLab Blog for installation guide links by version.
Important Notes
This guide is long because it covers many cases and includes all commands you need, this isone of the few installation scripts that actually works out of the box.
This installation guide was created for and tested on Debian/Ubuntu operating systems. Please readdoc/install/requirements.md for hardware and operating system requirements. If you want to install on RHEL/CentOS we recommend using theOmnibus packages.
This is the official installation guide to set up a production server. To set up adevelopment installation or for many other installation options please seethe installation section of the readme.
The following steps have been known to work. Please use caution when you deviate from this guide. Make sure you don't violate any assumptions GitLab makes about its environment. For example many people run into permission problems because they changed the location of directories or run services as the wrong user.
If you find a bug/error in this guide please submit a merge request following thecontributing guide.
Overview
The GitLab installation consists of setting up the following components:
- Packages / Dependencies
- Ruby
- System Users
- Database
- Redis
- GitLab
- Nginx
1. Packages / Dependencies
sudo
is not installed on Debian by default. Make sure your system isup-to-date and install it.
# run as root!
apt-get update -y
apt-get upgrade -y
apt-get install sudo -y
Note: During this installation some files will need to be edited manually. If you are familiar with vim set it as default editor with the commands below. If you are not familiar with vim please skip this and keep using the default editor.
# Install vim and set as default editor
sudo apt-get install -y vim
sudo update-alternatives --set editor /usr/bin/vim.basic
Install the required packages (needed to compile Ruby and native extensions to Ruby gems):
sudo apt-get install -y 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
Make sure you have the right version of Git installed
# Install Git
sudo apt-get install -y git-core
# Make sure Git is version 1.7.10 or higher, for example 1.7.12 or 2.0.0
git --version
Is the system packaged Git too old? Remove it and compile from source.
# Remove packaged Git
sudo apt-get remove git-core
# Install dependencies
sudo apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
# Download and compile from source
cd /tmp
curl -L --progress https://www.kernel.org/pub/software/scm/git/git-2.0.0.tar.gz | tar xz
cd git-2.0.0/
make prefix=/usr/local all
# Install into /usr/local/bin
sudo make prefix=/usr/local install
# When editing config/gitlab.yml (Step 5), change the git -> bin_path to /usr/local/bin/git
Note: In order to receive mail notifications, make sure to install a mail server. By default, Debian is shipped with exim4 but thishas problems while Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with:
sudo apt-get install -y postfix
Then select 'Internet Site' and press enter to confirm the hostname.
注意:安装git的路径默认会是“/usr/local/bin/git”,GitLab的API可能找不到git路径,因此,git安装成功后做个链接:ln /usr/local/bin/git /usr/bin/git。
2. Ruby
The use of ruby version managers such as RVM, rbenv orchruby with GitLab in production frequently leads to hard to diagnose problems. For example, GitLab Shell is called from OpenSSH and having a version manager can prevent pushing and pulling over SSH. Version managers are not supported and we strongly advise everyone to follow the instructions below to use a system ruby.
Remove the old Ruby 1.8 if present
sudo apt-get remove ruby1.8
Download Ruby and compile it:
mkdir /tmp/ruby && cd /tmp/ruby
curl -L --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz
cd ruby-2.1.2
./configure --disable-install-rdoc
make
sudo make install
Install the Bundler Gem:
sudo gem install bundler --no-ri --no-rdoc
3. System Users
Create a git
user for GitLab:
sudo adduser --disabled-login --gecos 'GitLab' git
4. Database
We recommend using a PostgreSQL database. For MySQL check MySQL setup guide. Note: because we need to make use of extensions you need at least pgsql 9.1.
# Install the database packages
sudo apt-get install -y postgresql postgresql-client libpq-dev
# Login to PostgreSQL
sudo -u postgres psql -d template1
# Create a user for GitLab.
template1=# CREATE USER git CREATEDB;
# Create the GitLab production database & grant all privileges on database
template1=# CREATE DATABASE gitlabhq_production OWNER git;
# Quit the database session
template1=# \q
# Try connecting to the new database with the new user
sudo -u git -H psql -d gitlabhq_production
5. Redis
sudo apt-get install redis-server
# Configure redis to use sockets
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
# Disable Redis listening on TCP by setting 'port' to 0
sed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf
# Enable Redis socket for default Debian / Ubuntu path
echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf
# Activate the changes to redis.conf
sudo service redis-server restart
# Add git to the redis group
sudo usermod -aG redis git
6. GitLab
GitLab 下载地址:https://github.com/gitlabhq/gitlabhq/archive/v7.3.0.tar.gz可使用 wget下载。
# We'll install GitLab into home directory of the user "git"
cd /home/git
Clone the Source
# Clone GitLab repository
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-3-stable gitlab
Note: You can change 7-3-stable
to master
if you want thebleeding edge version, but never install master on a production server!
Configure It
# Go to GitLab installation folder
cd /home/git/gitlab
# Copy the example GitLab config
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
# Update GitLab config file, follow the directions at top of file
sudo -u git -H editor config/gitlab.yml
# Make sure GitLab can write to the log/ and tmp/ directories
sudo chown -R git log/
sudo chown -R git tmp/
sudo chmod -R u+rwX log/
sudo chmod -R u+rwX tmp/
# Create directory for satellites
sudo -u git -H mkdir /home/git/gitlab-satellites
sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
# Make sure GitLab can write to the tmp/pids/ and tmp/sockets/ directories
sudo chmod -R u+rwX tmp/pids/
sudo chmod -R u+rwX tmp/sockets/
# Make sure GitLab can write to the public/uploads/ directory
sudo chmod -R u+rwX public/uploads
# Copy the example Unicorn config
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
# Find number of cores
nproc
# Enable cluster mode if you expect to have a high load instance
# Ex. change amount of workers to 3 for 2GB RAM server
# Set the number of workers to at least the number of cores
sudo -u git -H editor config/unicorn.rb
# Copy the example Rack attack config
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
# Configure Git global settings for git user, useful when editing via web
# Edit user.email according to what is set in gitlab.yml
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
# Configure Redis connection settings
sudo -u git -H cp config/resque.yml.example config/resque.yml
# Change the Redis socket path if you are not using the default Debian / Ubuntu configuration
sudo -u git -H editor config/resque.yml
Important Note: Make sure to edit both gitlab.yml
andunicorn.rb
to match your setup.
Note: If you want to use HTTPS, see Using HTTPS for the additional steps.
Configure GitLab DB Settings
# PostgreSQL only:
sudo -u git cp config/database.yml.postgresql config/database.yml
# MySQL only:
sudo -u git cp config/database.yml.mysql config/database.yml
# MySQL and remote PostgreSQL only:
# Update username/password in config/database.yml.
# You only need to adapt the production settings (first part).
# If you followed the database guide then please do as follows:
# Change 'secure password' with the value you have given to $password
# You can keep the double quotes around the password
sudo -u git -H editor config/database.yml
# PostgreSQL and MySQL:
# Make config/database.yml readable to git only
sudo -u git -H chmod o-rwx config/database.yml
Install Gems(可先参考第二段Ruby服务器地址替换)
安装前可能需要:
gem charlock_holmes 依赖:sudo apt-get install libicu-dev
gem rugged 依赖: sudo apt-get install cmake
gem mysql2 依赖:sudo apt-get install libmysqlclient-dev
编辑/home/git/gitlab/Gemfile: 添加: gem "rake", "~> 10.3.2"
Note: As of bundler 1.5.2, you can invoke bundle install -jN
(whereN
the number of your processor cores) and enjoy the parallel gems installation with measurable difference in completion time (~60% faster). Check the number of your cores withnproc
. For more information check thispost. First make sure you have bundler >= 1.5.2 (runbundle -v
) as it addresses someissues that werefixed in 1.5.2.
可能链接不上服务器,可以先参考参考:
https://ruby-china.org/topics/914
我照上面各位的指导做了,还是不对
我把系统的 sources 改成了淘宝源
$ gem sources --remove https://rubygems.org/
$ gem sources -a http://ruby.taobao.org/
同时把 Gemfile 的第一行改成了
source "http://ruby.taobao.org"
为什么在 bundle install 的时候还在访问 rubygems.org,输出如下
Fetching gem metadata from http://ruby.taobao.org/.
Fetching full source index from http://ruby.taobao.org/
Fetching gem metadata from http://rubygems.org/.
Fetching full source index from http://rubygems.org/
由于大陆的“特殊情况”,rails默认生成的Gemfile的源 https://rubygems.org 很慢甚至被重置,所以适应国情,要修改下Rails默认生成的Gemfile文件。
如何做呢?
很简单,切换到Rails的默认模板路径下,修改Gemfile文件的source:
1、找Gemfile
找到两个:
a. /home/git/gitlab/Gemfile
b. /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/templates/Gemfile
2、修改Gemfile文件,替换 https://rubygems.org 为 http://ruby.taobao.org 转自http://snails.github.io/2012/06/04/Modify-the-Gemfile-Template/
应该先到自己的根目录下去找Gemfile, 去改那里面的。
# For PostgreSQL (note, the option says "without ... mysql")
sudo -u git -H bundle install --deployment --without development test mysql aws
# Or if you use MySQL (note, the option says "without ... postgres")
sudo -u git -H bundle install --deployment --without development test postgres aws
安装成功后, 运行 gem list , 应显示结果见附录3.
Install GitLab Shell
GitLab Shell is an SSH access and repository management software developed specially for GitLab.
# Run the installation task for gitlab-shell (replace `REDIS_URL` if needed):
sudo -u git -H bundle exec rake gitlab:shell:install[v2.0.0] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production
# By default, the gitlab-shell config is generated from your main GitLab config.
# You can review (and modify) the gitlab-shell config as follows:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
Note: If you want to use HTTPS, see Using HTTPS for the additional steps.
Initialize Database and Activate Advanced Features
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production (不要在运行中执行,以免数据丢失)
# Type 'yes' to create the database tables.
# When done you see 'Administrator account created:'
Note: You can set the Administrator password by supplying it in environmental variableGITLAB_ROOT_PASSWORD
, eg.:
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=newpassword
Install Init Script
Download the init script (will be /etc/init.d/gitlab
):
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
And if you are installing with a non-default folder or user copy and edit the defaults file:
sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
If you installed GitLab in another directory or as a user other than the default you should change these settings in/etc/default/gitlab
. Do not edit/etc/init.d/gitlab
as it will be changed on upgrade.
Make GitLab start on boot:
sudo update-rc.d gitlab defaults 21
Setup Logrotate
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
Check Application Status(检测状态)
Check if GitLab and its environment are configured correctly:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
Compile Assets
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
Start Your GitLab Instance
sudo service gitlab start
# or
sudo /etc/init.d/gitlab restart
7. Nginx
Note: Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at theGitLab recipes.
Installation
sudo apt-get install -y nginx
Nginx Site Configuration
(注意如使用https , 文件 gitlab改为gitlab-ssl)
Copy the example site config:
sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
Make sure to edit the config file to match your setup:
# Change YOUR_SERVER_FQDN to the fully-qualified
# domain name of your host serving GitLab.
sudo editor /etc/nginx/sites-available/gitlab
Note: If you want to use HTTPS, replace the gitlab
Nginx config withgitlab-ssl
. SeeUsing HTTPS for HTTPS configuration details.
生成ssl证书(https哪里也有介绍)
# sudo mkdir /etc/nginx/ssl/
# cd /etc/nginx/ssl/
# sudo openssl req -new -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key
Nginx Test Configuration
Validate your gitlab
or gitlab-ssl
Nginx config file with the following command:
sudo nginx -t
You should receive syntax is okay
and test is successful
messages. If you receive errors check yourgitlab
orgitlab-ssl
Nginx config file for typos, etc. as indiciated in the error message given.
Restart
sudo service nginx restart
Done!
Double-check Application Status
To make sure you didn't miss anything run a more thorough check with:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
If all items are green, then congratulations on successfully installing GitLab!
NOTE: Supply SANITIZE=true
environment variable to gitlab:check
to omit project names from the output of the check command.
Initial Login
Visit YOUR_SERVER in your web browser for your first GitLab login. The setup has created an admin account for you. You can use it to log in:
root
5iveL!fe
Important Note: Please go over to your profile page and immediately change the password, so nobody can access your GitLab by using this login information later on.
Enjoy!
Advanced Setup Tips
Using HTTPS
To use GitLab with HTTPS:
- In
gitlab.yml
:
- Set the
port
option in section 1 to 443
.
- Set the
https
option in section 1 to true
.
- In the
/home/git/gitlab-shell/config.yml
of gitlab-shell:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
- Set
gitlab_url
option to the HTTPS endpoint of GitLab (e.g. https://git.example.com
).
- Set the certificates using either the
ca_file
or ca_path
option.(我未设置这个ca_file 与 ca_path)
- Use the
gitlab-ssl
Nginx example config instead of the gitlab
config.
- Update
YOUR_SERVER_FQDN
.(我写的localhost)
- Update
ssl_certificate
and ssl_certificate_key
.(设置时默认未动)
- Review the configuration file and consider applying other security and performance enhancing features.
4. Using a self-signed certificate is discouraged but if you must use it follow the normal directions then:
a. Generate a self-signed SSL certificate:
mkdir -p /etc/nginx/ssl/
cd /etc/nginx/ssl/
sudo openssl req -newkey rsa:2048 -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key
sudo chmod o-r gitlab.key
b. In the config.yml of gitlab-shell set self_signed_cert to true.
Check application status
Check if GitLab and its environment are configured correctly:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
To make sure you didn't miss anything run a more thorough check with:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
If all items are green, then the SSL certificate successfully implemented
Additional Markup Styles
Apart from the always supported markdown style there are other rich text files that GitLab can display. But you might have to install a dependency to do so. Please see thegithub-markup gem readme for more information.
Custom Redis Connection
If you'd like Resque to connect to a Redis server on a non-standard port or on a different host, you can configure its connection string via theconfig/resque.yml
file.
# example
production: redis://redis.example.tld:6379
If you want to connect the Redis server via socket, then use the "unix:" URL scheme and the path to the Redis socket file in theconfig/resque.yml
file.
# example
production: unix:/path/to/redis/socket
Custom SSH Connection
If you are running SSH on a non-standard port, you must change the GitLab user's SSH config.
# Add to /home/git/.ssh/config
host localhost # Give your setup a name (here: override localhost)
user git # Your remote git user
port 2222 # Your port number
hostname 127.0.0.1; # Your server name or IP
You also need to change the corresponding options (e.g. ssh_user
,ssh_host
,admin_uri
) in theconfig\gitlab.yml
file.
LDAP Authentication
You can configure LDAP authentication in config/gitlab.yml
. Please restart GitLab after editing this file.
Using Custom Omniauth Providers
See the omniauth integration document
附录-2:
你可能用了非80端口,这时你需要修改相应文件中的端口号,要修改的文件:
1./etc/nginx/sites-available/gitlab[-ssl]
2./home/git/gitlab/config/gitlab.yml
3./home/git/gitlab-shell/config.yml
附录-1:
可能会出现的问题:
1. 将Normal http host 配置当成https的配置改错位置了。
2. 客户端提示"SSL certificate problem:self signed certificate",解决办法:
克隆时添加参数"-c http.sslVerify=false",或者设置全局无ssl检测:"git config --global http.sslVerify false"
如:
git -c http.sslVerify=false clone https://domain.com/path/to/git
第2点与可以设置环境变量:GIT_SSL_NO_VERIFY=1,也可解决这个问题。
附录0:
可能提示rake版本过底解决方法:
gem install -v 10.3.2 rake
附录1:
代码服务器设置防火墙:
sudo iptables -P INPUT DROP
sudo iptables -P OUTPUT ACCEPT
sudo iptables -P FORWARD DROP
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 443 -j ACCEPT
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptabales -A OUTPUT -i lo -j ACCEPT
附录2:
文件大小限制设置
1. 设置gitlab的object size 大小
sudo editor /home/git/gitlab/config/gitlab.yml
将"max_size:2?????"改成需要的Bytes.
2. 设置nginx 的client_max_body_size
sudo editor /etc/nginx/sites-enabled/gitlab-ssl
设置client_max_body_size为:
client_max_body_size 2048m;
client_body_buffer_size 10m
3. 设置note.rb中的size
sudo editor /home/git/gitlab/app/models/note.rb
修改行:
validates :attachment, file_size: { maximum: 10.megabytes.to_i }
3.设置postBuffer
单独项目设置:
git config http.postBuffer 1024000000
全局设置:
git config --global http.postBuffer 1024000000
4.重启服务
sudo service gitlab restart
sudo service nginx restart
附录3:
ruby 2.1.3
gem list 显示结果:
*** LOCAL GEMS ***
ace-rails-ap (2.0.1)
actionmailer (4.1.1)
actionpack (4.1.1)
actionview (4.1.1)
activemodel (4.1.1)
activerecord (4.1.1)
activesupport (4.1.1)
acts-as-taggable-on (2.4.1)
addressable (2.3.5)
annotate (2.6.0)
arel (5.0.1.20140414130214)
asciidoctor (0.1.4)
awesome_print (1.2.0)
axiom-types (0.0.5)
bcrypt (3.1.7)
better_errors (1.0.1)
bigdecimal (1.2.4)
binding_of_caller (0.7.2)
bootstrap-sass (3.0.3.0)
builder (3.2.2)
bundler (1.7.4)
capybara (2.2.1)
carrierwave (0.9.0)
celluloid (0.15.2)
charlock_holmes (0.6.9.4)
cliver (0.3.2)
code_analyzer (0.4.3)
coderay (1.1.0)
coercible (1.0.0)
coffee-rails (4.0.1)
coffee-script (2.2.0)
coffee-script-source (1.6.3)
colored (1.2)
colorize (0.5.8)
connection_pool (1.2.0)
coveralls (0.7.0)
crack (0.4.1)
creole (0.3.8)
d3_rails (3.1.10)
daemons (1.1.9)
database_cleaner (1.3.0)
debug_inspector (0.0.2)
default_value_for (3.0.0)
descendants_tracker (0.0.3)
devise (3.2.4)
devise-async (0.9.0)
diff-lcs (1.2.5)
diffy (3.0.3)
docile (1.1.1)
dotenv (0.9.0)
dropzonejs-rails (0.4.14)
email_spec (1.5.0)
emoji (1.0.1)
enumerize (0.7.0)
equalizer (0.0.8)
erubis (2.7.0)
escape_utils (0.2.4)
eventmachine (1.0.3)
excon (0.32.1)
execjs (2.0.2)
expression_parser (0.9.0)
factory_girl (4.3.0)
factory_girl_rails (4.3.0)
faraday (0.8.9)
faraday_middleware (0.9.0)
ffaker (1.22.1)
ffi (1.9.3)
fog (1.21.0)
fog-brightbox (0.0.1)
fog-core (1.21.1)
fog-json (1.0.0)
font-awesome-rails (3.2.1.3)
foreman (0.63.0)
formatador (0.2.4)
gemnasium-gitlab-service (0.2.2)
gherkin-ruby (0.3.1)
github-markup (1.1.0)
gitlab-flowdock-git-hook (0.4.2.2)
gitlab-grack (2.0.0.pre)
gitlab-grit (2.6.11)
gitlab-linguist (3.0.0)
gitlab_emoji (0.0.1.1)
gitlab_git (6.2.1)
gitlab_meta (7.0)
gitlab_omniauth-ldap (1.1.0)
gollum-lib (3.0.0)
gon (5.0.1)
grape (0.6.1)
grape-entity (0.4.2)
growl (1.0.3)
guard (2.2.4)
guard-rspec (4.2.0)
guard-spinach (0.0.2)
haml (4.0.5)
haml-rails (0.5.3)
hashie (2.1.2)
hike (1.2.3)
hipchat (0.14.0)
http_parser.rb (0.5.3)
httparty (0.13.0)
httpauth (0.2.1)
i18n (0.6.11)
ice_nine (0.10.0)
io-console (0.4.2)
jasmine (2.0.2)
jasmine-core (2.0.0)
jquery-atwho-rails (0.3.3)
jquery-rails (3.1.0)
jquery-scrollto-rails (1.4.3)
jquery-turbolinks (2.0.1)
jquery-ui-rails (4.2.1)
json (1.8.1)
jwt (0.1.13)
kaminari (0.15.1)
kgio (2.8.1)
launchy (2.4.2)
letter_opener (1.1.2)
libv8 (3.16.14.3 x86_64-linux)
listen (2.3.1)
lumberjack (1.0.4)
mail (2.5.4)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.0)
minitest (5.3.5, 4.7.5)
mousetrap-rails (1.4.6)
multi_json (1.10.1)
multi_xml (0.5.5)
multipart-post (1.2.0)
mysql2 (0.3.16)
net-ldap (0.7.0)
net-scp (1.1.2)
net-ssh (2.8.0)
newrelic_rpm (3.9.4.245)
nokogiri (1.6.2.1)
nprogress-rails (0.1.2.3)
oauth (0.4.7)
oauth2 (0.8.1)
omniauth (1.1.4)
omniauth-github (1.1.1)
omniauth-google-oauth2 (0.2.5)
omniauth-oauth (1.0.1)
omniauth-oauth2 (1.1.1)
omniauth-shibboleth (1.1.1)
omniauth-twitter (1.0.1)
org-ruby (0.9.8)
orm_adapter (0.5.0)
pg (0.15.1)
phantomjs (1.9.2.0)
poltergeist (1.5.1)
polyglot (0.3.4)
posix-spawn (0.3.9)
pry (0.9.12.4)
psych (2.0.5)
pyu-ruby-sasl (0.0.3.3)
quiet_assets (1.0.2)
racc (1.4.10)
rack (1.5.2)
rack-accept (0.4.5)
rack-attack (2.3.0)
rack-cors (0.2.9)
rack-mini-profiler (0.9.0)
rack-mount (0.8.3)
rack-protection (1.5.1)
rack-test (0.6.2)
rails (4.1.1)
rails_autolink (1.1.6)
rails_best_practices (1.14.4)
railties (4.1.1)
raindrops (0.12.0)
rake (10.3.2, 10.1.0)
raphael-rails (2.1.2)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
rdoc (4.1.0, 3.12.2)
redcarpet (3.1.2)
RedCloth (4.2.9)
redis (3.0.6)
redis-actionpack (4.0.0)
redis-activesupport (4.0.0)
redis-namespace (1.4.1)
redis-rack (1.5.0)
redis-rails (4.0.0)
redis-store (1.1.4)
ref (1.0.5)
request_store (1.0.5)
require_all (1.3.2)
rest-client (1.6.7)
rinku (1.7.3)
rouge (1.3.3)
rspec (2.14.1)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
rspec-mocks (2.14.4)
rspec-rails (2.14.0)
ruby-progressbar (1.2.0)
rubyntlm (0.1.1)
rubypants (0.2.0)
rugged (0.21.0)
safe_yaml (0.9.7)
sanitize (2.1.0)
sass (3.2.19)
sass-rails (4.0.3)
sdoc (0.3.20)
seed-fu (2.3.1)
select2-rails (3.5.2)
semantic-ui-sass (0.16.1.0)
settingslogic (2.0.9)
sexp_processor (4.4.0)
shoulda-matchers (2.1.0)
sidekiq (2.17.0)
simple_oauth (0.1.9)
simplecov (0.8.2)
simplecov-html (0.8.0)
sinatra (1.4.4)
six (0.2.0)
slack-notifier (0.3.2)
slim (2.0.2)
slop (3.4.7)
spinach (0.8.7)
spinach-rails (0.2.1)
spring (1.1.3)
spring-commands-rspec (1.0.1)
spring-commands-spinach (1.0.0)
sprockets (2.11.0)
sprockets-rails (2.1.3)
stamp (0.5.0)
state_machine (1.2.0)
stringex (2.5.1)
temple (0.6.7)
term-ansicolor (1.2.2)
test-unit (2.1.3.0)
test_after_commit (0.2.2)
therubyracer (0.12.0)
thin (1.6.1)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (1.1.0)
tinder (1.9.3)
tins (0.13.1)
treetop (1.4.15)
turbolinks (2.0.0)
twitter-stream (0.1.16)
tzinfo (1.2.2)
uglifier (2.3.2)
underscore-rails (1.4.4)
unf (0.1.4)
unf_ext (0.0.6)
unicorn (4.6.3)
unicorn-worker-killer (0.4.2)
version_sorter (1.1.0)
virtus (1.0.1)
warden (1.2.3)
webmock (1.16.0)
websocket-driver (0.3.3)
wikicloth (0.8.1)
xpath (2.0.0)
附录4:
Git config for git user? no错误(我没有处理这个错误,上传代码下载代码没受引响,不知道为什么):
http://superuser.com/questions/743970/error-in-gitlab-git-configured-for-git-user-no-try-fixing-it
Until today evening everything was working fine. I don't how server goes down, some one would have turned off but after I restart server and lxc container where gitlab is used to run, I tried to access gitlab by the server IP:192.168.2.9(container IP) in browser I get response as Oops! Google Chrome could not connect to 192.168.2.9 . I check in server asservice gitlab status it shows gitlab is up and running.
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
Git configured for git user? ... no
Try fixing it:
sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "[email protected]"
For more information see: doc/install/installation.md in section "GitLab"
Please fix the error above and rerun the checks.
Then I checked doc/install/installation.md file I find these two line
sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "gitlab@localhost"
then I changed it to
sudo -u git -H git config --global user.name "git"
sudo -u git -H git config --global user.email "[email protected]"
and checked config/gitlab.yml there the email_from already set as[email protected] and default user asgit . run again same line and get same error again
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
Git configured for git user? ... no
Try fixing it:
sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "[email protected]"
For more information see: doc/install/installation.md in section "GitLab"
Please fix the error above and rerun the checks.
Then I did sudo su -git and did git config --list
[email protected] = input
I tried to find any occurrence of gitlab@localhost inside home/git/gitlab, I don't find andy occurrence ofgitlab@localhost except some logs fine andgitlab.yml.example .
I tried to find any occurrence of gitlab@localhost inside home/git/ here I foundgitlab@localhost in/home/git/.gitconfig . In .gitconfig I see
[user]name = GitLabemail = gitlab@localhost[core]autocrlg = input
and changed to
[user]name = gitemail = [email protected][core]autocrlg = input
Now when I run git config --list
[email protected] = input
but when I run
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
I get same error again
Git configured for git user? ... no
Try fixing it:
sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "[email protected]"
For more information see: doc/install/installation.md in section "GitLab"
Please fix the error above and rerun the checks.
I checked every time with restart the gitlab again and again. I have now I idea whats happen suddenly. What I did when I start the server was started the git container fromLXC Web panel . Any help?
UPATE
I found the occurrence of user.name GitLab in howe/git/gitlab/lib/tasks/gitlab/check.rake file and chandedGitLab togit . now when I runsudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
I see the result is
Git configured for git user? ... yes
but still I don't get gitlab up when I try to access from browser. what would be the problem?
附录5:
上传项目文件多文件大时TortoiseGIT卡起不动。作如下处理,但还是一样的问题:
git config --global core.autocrlf false
git config --global core.safecrlf true
git config --global http.postBuffer 1000000000
还修改了:nginx的gitlab-ssl 中的client_max_body_size:为 4096m.但还是一样的问题:
最后解决办法:
将项目分成多个部分,每部分小于500MB,然后分部分上传,最后上传成功。
不知是不是timeout引起的,后来设置了一下nginx 的 “
keepalive
_
timeout 1800" 与 "send_timeout 300" 好像还是不能上传久的大的项目。
后来又修改了: /home/git/gitlab/config/unicorn.rb
将 timeout改成了600。
将文件:/home/git/gitlab/config/gitlab.yml中的timeout 也作了改大处理,改成了600。
上面的完成后,就没出问题了。
附录6:
修改repositories 的位置
1. repositories位置设置:
sudo editor /home/git/gitlab/config/gitlab.yml
修改 path_repos
2. 停止gitlab
sudo service gitlab stop
3. 安装gitlab-shell
sudo -u git -H bundle exec rake gitlab:shell:install[v2.0.0] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production
4. 修改/home/git/gitlab-shell/config.yml
设置"set self_signed_cert"为true
5.启动gitlab服务
sudo service gitlab start
附录7:
密码忘记后密码恢复:
1. 链接数据库
>sudo -u postgres psql gitlabhq_production
2.然后从users表查出数据
select * from users;
3. 找到一个已知密码的用户并拷贝他的密码
update users set encrypted_password='知道密码的用户的加密后的密码字串' where email='user_email_address'
加密后字符串是bcrypt生成的,有python版本,可安装一个生成一个,再update进即可。
给个知道密码明文的密码字符串:123 10轮加密后是:'$2a$10$x/loqHZznmjl4dT4dlOahesEuIo6kdSGL4OUoHPcCdLgsPZNhBnfm'。
4. 用修改后的密码登录后可能会提示错误,但回到首页再次登录会成功。
5. 重启gitlab:
sudo service gitlab restart
6. 完成
|