这个问题我找到了自己的解决方法:
gitlab-shell 用 master 分支时 gitlab-shell/hooks/ 目录下 没有 update 文件,用以下命令:
# cd /home/git/gitlab-shell/
# git branch v1.9.8
这样gitlab-shell/hooks/ 目录下就有了 update 文件,再执行 push 就可以成功了。
gao@gao-VirtualBox:/var/www/html5$ git push -u origin masterUsername for 'http://gitlab.gxlhost.com': [email protected]
Password for 'http://[email protected]@gitlab.gxlhost.com':
对象计数中: 3, 完成.
写入对象中: 100% (3/3), 238 bytes | 0 bytes/s, 完成.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: You are not allowed to access some of the refs!
To http://gitlab.gxlhost.com/root/html5.git
! [remote rejected] master -> master (pre-receive hook declined)
error: 无法推送一些引用到 'http://gitlab.gxlhost.com/root/html5.git'
gao@gao-VirtualBox:/var/www/html5$ git push -u origin -f master
Username for 'http://gitlab.gxlhost.com': [email protected]
Password for 'http://[email protected]@gitlab.gxlhost.com':
对象计数中: 3, 完成.
写入对象中: 100% (3/3), 238 bytes | 0 bytes/s, 完成.
Total 3 (delta 0), reused 0 (delta 0)
error: RPC failed; result=18, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date
gao@gao-VirtualBox:/var/www/hotel$ git remote add origin https://gitlab.gxl.com/root/hotel.git
gao@gao-VirtualBox:/var/www/hotel$ git push -u origin master
fatal: unable to access 'https://gitlab.gxl.com/root/hotel.git/': Couldn't resolve host 'gitlab.gxl.com'
gao@gao-VirtualBox:/var/www/hotel$ git push -u origin master
fatal: unable to access 'https://gitlab.gxl.com/root/hotel.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
gao@gao-VirtualBox:~$ cd /home/git/gitlab
gao@gao-VirtualBox:/home/git/gitlab$ sudo bundle exec rake gitlab:check RAILS_ENV=production
Warning
You are running as user root, we hope you know what you are doing.
Things may work/fail for the wrong reasons.
For correct results you should run this as user git.
Checking Environment ...
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.
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.9.6 ? ... OK (2.0.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
Satellites access is drwxr-x---? ... yes
update hook up-to-date? ... no
Could not find /home/git/gitlab-shell/hooks/update
Try fixing it:
Check the hooks_path in config/gitlab.yml
Check your gitlab-shell installation
For more information see:
doc/install/installation.md in section "GitLab Shell"
update hooks in repos are links: ... can't check because of previous errors
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK
Test redis-cli executable: FAILED
gitlab-shell self-check failed
Try fixing it:
Make sure GitLab is running;
Check the gitlab-shell configuration file:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
Please fix the error above and rerun the checks.
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... no
Try fixing it:
sudo -u git -H RAILS_ENV=production bin/background_jobs start
For more information see:
doc/install/installation.md in section "Install Init Script"
see log/sidekiq.log for possible errors
Please fix the error above and rerun the checks.
Checking Sidekiq ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
Database contains orphaned UsersGroups? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ...
Administrator / html5 ... yes
Projects have satellites? ...
Administrator / html5 ... can't create, repository is empty
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (2.1.0)
Checking GitLab ... Finished
gao@gao-VirtualBox:/home/git/gitlab$
gao@gao-VirtualBox:~$ ps aux | grep gitlab
git 1829 0.0 3.3 158308 39860 ? Sl 08:55 0:05 unicorn_rails master -D -c /home/git/gitlab/config/unicorn.rb -E production
git 1871 0.0 8.0 161496 97344 ? Sl 08:56 0:02 unicorn_rails worker[0] -D -c /home/git/gitlab/config/unicorn.rb -E production
git 1874 0.0 8.1 162176 98016 ? Sl 08:56 0:02 unicorn_rails worker[1] -D -c /home/git/gitlab/config/unicorn.rb -E production
git 1899 0.1 9.3 244732 113060 ? Sl 08:56 0:13 sidekiq 2.17.0 gitlab [0 of 25 busy]
gao 3949 0.0 0.0 5836 824 pts/5 S+ 11:14 0:00 grep --color=auto gitlab
gao@gao-VirtualBox:~$
gao@gao-VirtualBox:/home/git/gitlab$ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System: Ubuntu 12.04
Current User: git
Using RVM: no
Ruby Version: 2.1.2p95
Gem Version: 2.4.1
Bundler Version:1.7.3
Rake Version: 10.3.2
Sidekiq Version:2.17.0
GitLab information
Version: 7.1.1
Revision: facfec4
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://gitlab.gxlhost.com
HTTP Clone URL: http://gitlab.gxlhost.com/some-project.git
SSH Clone URL: [email protected]:some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 2.0.0.pre
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git
gao@gao-VirtualBox:/home/git/gitlab$
gao@gao-VirtualBox:/home/git/gitlab$ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...
Git configured for git user? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.9.6 ? ... OK (2.0.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
Satellites access is drwxr-x---? ... yes
update hook up-to-date? ... no
Could not find /home/git/gitlab-shell/hooks/update
Try fixing it:
Check the hooks_path in config/gitlab.yml
Check your gitlab-shell installation
For more information see:
doc/install/installation.md in section "GitLab Shell"
update hooks in repos are links: ... can't check because of previous errors
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/home/git/repositories: OK
/home/git/.ssh/authorized_keys: OK
Test redis-cli executable: FAILED
gitlab-shell self-check failed
Try fixing it:
Make sure GitLab is running;
Check the gitlab-shell configuration file:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
Please fix the error above and rerun the checks.
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
Database contains orphaned UsersGroups? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ...
Administrator / html5 ... yes
Projects have satellites? ...
Administrator / html5 ... can't create, repository is empty
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (2.1.0)
Checking GitLab ... Finished
----------------------
执行了
gao@gao-VirtualBox:/home/git/gitlab$ sudo -u git -H bundle exec rake gitlab:shell:install[v2.0.0] REDIS_URL=redis://localhost:6379 RAILS_ENV=production
[sudo] password for gao:
git fetch origin && git reset --hard $(git describe v2.0.0 || git describe origin/v2.0.0)
remote: Counting objects: 111, done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 111 (delta 57), reused 79 (delta 41)
接收对象中: 100% (111/111), 24.31 KiB | 0 bytes/s, 完成.
处理 delta 中: 100% (57/57), 完成.
来自 https://github.com/gitlabhq/gitlab-shell
3f36541..e49cb2b master -> origin/master
* [新分支] version-1-9 -> origin/version-1-9
* [新tag] v1.9.8 -> v1.9.8
* [新tag] v2.0.0 -> v2.0.0
* [新tag] v2.0.1 -> v2.0.1
HEAD 现在位于 67eb0c4 Version 2.0.0
bin/install
mkdir -p /home/git/repositories/: OK
mkdir -p /home/git/.ssh: OK
chmod 700 /home/git/.ssh: OK
touch /home/git/.ssh/authorized_keys: OK
chmod 600 /home/git/.ssh/authorized_keys: OK
chmod -R ug+rwX,o-rwx /home/git/repositories/: OK
find /home/git/repositories/ -type d -exec chmod g+s {} ;: OK
gao@gao-VirtualBox:/home/git/gitlab$
---------------------
获得如下:
gao@gao-VirtualBox:/home/git/gitlab$ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
[sudo] password for gao:
Checking Environment ...
Git configured for git user? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.9.6 ? ... OK (2.0.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
Satellites access is drwxr-x---? ... yes
update hook up-to-date? ... no
Could not find /home/git/gitlab-shell/hooks/update
Try fixing it:
Check the hooks_path in config/gitlab.yml
Check your gitlab-shell installation
For more information see:
doc/install/installation.md in section "GitLab Shell"
update hooks in repos are links: ... can't check because of previous errors
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/home/git/repositories/: OK
/home/git/.ssh/authorized_keys: OK
Test redis-cli executable: redis-cli 2.8.13
Send ping to redis server: PONG
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
Database contains orphaned UsersGroups? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ...
Administrator / html5 ... yes
Projects have satellites? ...
Administrator / html5 ... can't create, repository is empty
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (2.1.0)
Checking GitLab ... Finished
gao@gao-VirtualBox:/home/git/gitlab$