`

gitlab push ! [remote rejected] master -> master (pre-receive hook declined)

    博客分类:
  • git
 
阅读更多

这个问题我找到了自己的解决方法:

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': admin@example.com
Password for 'http://admin@example.com@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': admin@example.com
Password for 'http://admin@example.com@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 "gitlab@gxlhost.com"
  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:    git@gitlab.gxlhost.com: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$

分享到:
评论

相关推荐

    JS手写一个自定义Promise操作示例

    这两个函数是Promise的核心,分别用于将Promise的状态从`pending`(等待)变为`resolved`(成功)或`rejected`(失败)。 在`MyPromise`的构造函数中,我们初始化了一些关键属性: 1. `state`:表示Promise的状态,...

    java坑爹的笔试题-gitee-bullshit-codes:从https://gitee.com/oschina/bullshit-cod

    java坑爹的笔试题 没有最坑,只有更坑! 活动简介 作为一个程序员,你看过哪些坑爹代码,你又写过多少坑爹代码,还有多少你不知道的坑爹代码?本仓库的目的就是为了收集这些坑爹代码,可以让别人不掉坑或者少掉坑,...

    idea上传代码到github时遇到的Push rejected: Push to origin/master was rejected

    在使用IntelliJ IDEA(简称Idea)上传代码到GitHub时,可能会遇到“Push rejected: Push to origin/master was rejected”的错误。这个问题通常发生在你尝试将一个新的项目推送到一个已存在文件的GitHub仓库时。以下...

    Git发现git push origin master 报错的解决方法

    git push origin master 报错的解决方法,分享给大家,... [rejected] master -> master (fetch first) error: failed to push some refs to 'git@github.com:kangvcar/Results-Systems--PHP.git' hint: Updates were r

    智能停车场

    if (onlineMonitoring->exec() == QDialog::Rejected) { this->show(); } } /*------------------------------------------- * * 人事信息 * ---------------------------------------------*/ void ...

    Python库 | rejected-3.18.4-py2.py3-none-any.whl

    "rejected-3.18.4-py2.py3-none-any.whl" 是一个针对Python的特定版本编译的库包,主要用于Python 2和Python 3环境。这个whl文件是一种二进制分发格式,它使得安装Python库变得更加便捷,避免了编译源代码的过程。 ...

    idea上提交项目到gitee 最后出现 Push rejected的问题处理方法

    在使用IntelliJ IDEA(简称Idea)进行项目开发时,有时在将代码推送到Gitee(中国的Git托管平台)时,可能会遇到“Push rejected”的错误提示。这个错误通常是由于多种原因引起的,如本地分支与远程分支存在冲突、...

    Python库 | rejected-peps-0.2.2.tar.gz

    资源分类:Python库 所属语言:Python 资源全名:rejected-peps-0.2.2.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    git提交项目到码云步骤及出现问题解决办法

    [rejected] master -> master (fetch first) error: failed to push some refs to 'https://gitee.com/heguxin/cas_fn.git' hint: Updates were rejected because the remote contains work that you do hint: not ...

    laravel-model-status:轻松向模型添加状态

    $ model -> setStatus ( 'rejected' , 'My rejection reason' ); // get the current status $ model -> status (); // returns an instance of \Spatie\ModelStatus\Status // get the previous

    上传war文件大小超过Tomcat7最大文件限制报错

    --100MBmax--> <max-file-size>104857600</max-file-size> <max-request-size>104857600</max-request-size> <file-size-threshold>0</file-size-threshold> </multipart-config> ``` - 其中,`max-file-size`...

    Python库 | rejected_peps-0.2.5-py3-none-any.whl

    `rejected_peps-0.2.5-py3-none-any.whl` 是一个特定版本的Python库,它包含了`rejected_peps`库的源代码和元数据,适用于Python 3解释器。 `rejected_peps`库可能是一个专门用于处理或参考被Python开发者社区拒绝...

    idea配置git教程.docx

    当推送失败,提示“push to origin/master was rejected”时,这通常是因为本地仓库与远程仓库存在冲突。解决方法包括: - `git pull`:尝试从远程仓库拉取最新的更改。 - `git pull origin master`:明确指定从...

    执行git push会遇到的问题

    [rejected] master -> master (fetch first)** 当你尝试推送`master`分支到远程仓库,但远程仓库有你本地没有的更改时,Git会拒绝推送并显示此错误。 解决方法: - 首先,你需要获取远程仓库的最新更改,使用`...

    git push rejected

    git push rejectedgit push rejectedgit push rejectedgit push rejectedgit push rejectedgit push rejectedgit push rejectedgit push rejectedgit push rejectedgit push rejectedgit push rejectedgit push ...

Global site tag (gtag.js) - Google Analytics