Gitlab 安装成功、创建项目后添加 ssh key、push 遇到各种问题

2015-01-22 15:11:59 +08:00
 tekin

按照官方教程安装成功、参考地址:
https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/install/centos
但最后创建项目push遇到各种哦你我跟体、想放弃的念头都有了、折腾了一个星期多、还未能解决。
相关设置和数据如下:
gitlab版本和相关数据:
System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.1.5p273
Gem Version: 2.2.2
Bundler Version:1.7.12
Rake Version: 10.3.2
Sidekiq Version:2.17.8

GitLab information
Version: 7.6.2
Revision: 16f0968
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://git.urumqi.cn
HTTP Clone URL: http://git.urumqi.cn/some-project.git
SSH Clone URL: git@git.urumqi.cn:some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version: 2.1.0
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/local/bin/git

gitlab环境检查:
Checking Environment ...

Git configured for git user? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 2.4.0 ? ... FAIL. Please update gitlab-shell to 2.4.0 from 2.1.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
hooks directories in repos are links: ...
Administrator / Katip ... repository is empty
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.4.10
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 GroupMembers? ... 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? ... no
Try fixing it:
Redownload the init script
For more information see:
doc/install/installation.md in section "Install Init Script"
Please fix the error above and rerun the checks.
projects have namespace: ...
Administrator / Katip ... yes
Projects have satellites? ...
Administrator / Katip ... can't create, repository is empty
Redis version >= 2.0.0? ... yes
Ruby version >= 2.0.0 ? ... yes (2.1.5)
Your git bin path is "/usr/local/bin/git"
Git version >= 1.7.10 ? ... yes (2.1.3)

Checking GitLab ... Finished

gitlab.yml修改的数据:
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: git.urumqi.cn
port: 80 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
https: false

email_from: 84247764@qq.com
ssh_port: 51905

unicorn.rb修改的数据:
worker_processes 1
listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 1024
listen "127.0.0.1:8080", :tcp_nopush => true

resque.yml数据:
development: redis://localhost:6379
test: redis://localhost:6379
production: unix:/var/run/redis/redis.sock

gitlab-sheel/config.yml数据:

user: git
gitlab_url: http://git.urumqi.cn/
http_settings:
self_signed_cert: false
repos_path: "/home/git/repositories/"
auth_file: "/home/git/.ssh/authorized_keys"
redis:
bin: "/usr/bin/redis-cli"
host: 127.0.0.1
port: 6379
namespace: resque:gitlab
socket: "/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false

nginx参数设置:
listen 0.0.0.0:80 default_server;
#listen [::]:80 default_server;
server_name git.urumqi.cn; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
root /home/git/gitlab/public;

git目录权限:
4.0K drwxr-xr-x 17 git git 4.0K 1月 21 15:03 gitlab
4.0K drwxr-x--- 2 git git 4.0K 1月 21 12:49 gitlab-satellites
4.0K drwxr-xr-x 8 git git 4.0K 1月 22 12:49 gitlab-shell
83M -rw-r--r-- 1 git git 83M 1月 21 11:43 gitlab.tzr.gz
4.0K drwxr-xr-x 2 git git 4.0K 11月 12 2010 .gnome2
4.0K drwxr-xr-x 4 git git 4.0K 11月 29 2013 .mozilla
4.0K -rw------- 1 git git 19 1月 21 12:37 .mysql_history
4.0K drwxr----- 3 git git 4.0K 1月 21 10:57 .pki
4.0K drwxrws--- 3 git git 4.0K 1月 21 15:15 repositories
4.0K drwx------ 2 git git 4.0K 1月 21 17:24 .ssh
4.0K -rw------- 1 git git 3.1K 1月 21 15:09 .viminfo

.ssh目录权限:
drwx------ 2 git git 4.0K 1月 21 17:24 .
drwxr-x--x 10 git git 4.0K 1月 21 16:44 ..
-rw------- 1 git git 517 1月 21 17:24 authorized_keys
-rw-r--r-- 1 git git 0 1月 21 17:24 authorized_keys.lock
-rw-r--r-- 1 git git 96 1月 21 15:03 environment

本地生成id_rsa.pub内容和authorized_keys内容匹配。

但现在push无法工作, http和ssh方式都不行,希望有经验的高手能帮我看看、谢谢

push错误信息:
$ git push -u origin master
Permission denied (publickey,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

网上的各种修改都试过了无解。

联系QQ:
84247764

11406 次点击
所在节点    Ruby on Rails
40 条回复
lyf362345
2015-01-23 02:10:19 +08:00
@timsims 你是何zq 么 哈哈 猜猜我是谁
tekin
2015-01-23 02:24:27 +08:00
@lyf362345 系统是centos6,是按照官方教程一步步安装的,一次安装成功,但无法push、加我QQ
lyf362345
2015-01-23 02:41:33 +08:00
@tekin 就不加 qq 了,你留意下安装文档里的
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

service gitlab start
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
的输出,一个是检查环境,一个是检查安装后运行情况,如果检查都通过就绝对不会有问题。
另外我是用的 ubuntu 但是大致看了下 差别没达到哪去,而且我还是 https 的
kingme
2015-01-23 08:59:14 +08:00
bitnami的一键安装包或者直接用部署好的虚拟机吧
zzd1000
2015-01-23 09:14:55 +08:00
看看你的文件夹权限 多了少了都不行
L3ve
2015-01-23 09:29:17 +08:00
之前我也是搞了很久...之后发现是墙的问题...你试试看在DNS添加8.8.8.8
sujin190
2015-01-23 09:30:59 +08:00
id_rsa.pub是直接authorized_keys文件的么?直接修改貌似不行,必须在gitlab中创建才行
sujin190
2015-01-23 09:39:31 +08:00
gitlab-shell下面有push操作的日志,可以去看下
lerry
2015-01-23 09:53:48 +08:00
@tekin Debian wheezy 64位 http, push正常,你可以给我发邮件,看我资料页有邮箱地址
zyAndroid
2015-01-23 11:26:14 +08:00
@timsims 正解,简单省心不折腾
66450146
2015-01-23 11:34:40 +08:00
折腾过两次,现在买了 GitHub 的服务,实在太麻烦了
tekin
2015-01-23 11:52:43 +08:00
重新安装了一遍,最后检查出问题:
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:879:in `initialize': Address family not supported by protocol - socket(2) for "localhost" port 8080 (Errno::EAFNOSUPPORT)
from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:879:in `open'
from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:879:in `block in connect'
from /usr/local/ruby/lib/ruby/2.1.0/timeout.rb:76:in `timeout'
from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:878:in `connect'
from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:852:in `start'
from /home/git/gitlab-shell/lib/gitlab_net.rb:86:in `get'
from /home/git/gitlab-shell/lib/gitlab_net.rb:44:in `check'
from /home/git/gitlab-shell/bin/check:11:in `<main>'
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.

config.yml:
gitlab_url: "http://localhost:8080"

unicorn.rb:
listen "127.0.0.1:8080", :tcp_nopush => true

gitlab.yml:
port: 80
tekin
2015-01-23 12:01:08 +08:00
/etc/hosts添加 127.0.0.1 localhost 就可以了、我先测试功能
tekin
2015-01-23 12:23:45 +08:00
ssh方式正常,但 http方式 push报错:
Total 3 (delta 0), reused 0 (delta 0)
remote: /usr/local/ruby/lib/ruby/2.1.0/net/protocol.rb:158:in `rescue in rbuf_fill': Net::ReadTimeout (Net::ReadTimeout)
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/protocol.rb:152:in `rbuf_fill'
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/protocol.rb:134:in `readuntil'
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/protocol.rb:144:in `readline'
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/http/response.rb:39:in `read_status_line'
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/http/response.rb:28:in `read_new'
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:1408:in `block in transport_request'
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:1405:in `catch'
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:1405:in `transport_request'
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:1378:in `request'
remote: from /home/git/gitlab-shell/lib/gitlab_net.rb:103:in `block in post'
remote: from /usr/local/ruby/lib/ruby/2.1.0/net/http.rb:853:in `start'
remote: from /home/git/gitlab-shell/lib/gitlab_net.rb:103:in `post'
remote: from /home/git/gitlab-shell/lib/gitlab_net.rb:28:in `check_access'
remote: from /home/git/gitlab-shell/lib/gitlab_access.rb:21:in `exec'
remote: from hooks/pre-receive:13:in `<main>'
To http://xxxxx/root/hello.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://xxxxx/root/hello.git'
tekin
2015-01-23 15:10:35 +08:00
总结一下:
如果机器配置低bitnami的和别的一键安装可能不合适,低配置最好自己编译安装,有点麻烦,但还是能成功的。 谢谢大家总算成功了。版本问题和权限问题。目前只能是ssh方式可以了。
tekin
2015-01-23 15:12:19 +08:00
windows下 git bash响应很慢,是什么问题导致的,大家有遇到过吗?
gevin
2015-01-23 15:56:17 +08:00
我的GitLab装点docker版本,配置非常简单,推荐一下

https://github.com/sameersbn/docker-gitlab
tekin
2015-01-23 16:38:49 +08:00
@gevin 我就一台VPS暂时不安装docker了,以后需要时看看,谢谢
lostsnow
2015-01-23 17:31:21 +08:00
还是用gogs吧, ruby这个坑货```
mephisto
2015-01-24 13:17:25 +08:00
最多几个小时搞定, 官方不是有打好的包(rpm)吗?照着文档就能搞定(下包慢点)

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/164493

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX