V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
tekin
V2EX  ›  Ruby on Rails

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

  •  
  •   tekin · 2015-01-22 15:11:59 +08:00 · 11622 次点击
    这是一个创建于 3595 天前的主题,其中的信息可能已经有所发展或是发生改变。

    按照官方教程安装成功、参考地址:
    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: [email protected]: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: [email protected]
    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

    40 条回复    2015-01-24 13:17:25 +08:00
    koy1619
        1
    koy1619  
       2015-01-22 16:19:19 +08:00   ❤️ 1
    lex
        2
    lex  
       2015-01-22 17:11:29 +08:00   ❤️ 2
    现在官方有 Omnibus 的安装包相当好用:
    https://about.gitlab.com/downloads/

    如果会用 Ansible,可以用我做的一键安装 GitLab 的配置:
    https://github.com/lexrus/ios-dev-playbook
    tekin
        3
    tekin  
    OP
       2015-01-22 17:31:46 +08:00
    官方一键安装包返回:
    package gitlab-7.2.1_omnibus-1.el6.x86_64 is intended for a x86_64 architecture
    不支持还是怎么回事?
    timsims
        4
    timsims  
       2015-01-22 17:51:18 +08:00   ❤️ 2
    表示折腾过一次之后压根不想再碰gitlab

    我们公司现在直接上Docker,镜像别人弄好了,只要配置好redis和mysql账号密码什么的就可以使用,而且升级也方便

    https://github.com/sameersbn/docker-gitlab
    tekin
        5
    tekin  
    OP
       2015-01-22 18:00:49 +08:00
    如果有谁想远程帮我看看,联系QQ:84247764、到时候也 可以提供服务器
    ldehai
        6
    ldehai  
       2015-01-22 20:34:19 +08:00   ❤️ 1
    @tekin 是不是gitlab服务器里面ip地址没写对,要写服务器实际的ip地址。我们也是用的gitlab,不过没折腾ssh,都是用的https。
    mengzhuo
        7
    mengzhuo  
       2015-01-22 20:55:59 +08:00
    >>> package gitlab-7.2.1_omnibus-1.el6.x86_64 is intended for a x86_64 architecture
    >>> 不支持还是怎么回事?

    人家只支持x86 64位
    tekin
        8
    tekin  
    OP
       2015-01-22 22:33:52 +08:00
    @ldehai 是gitlab--config/gitlab.yml里写的是域名、上面提供了相关配置参数,能帮我看看吗? 配置参数是否正确?
    tekin
        9
    tekin  
    OP
       2015-01-22 22:37:32 +08:00
    @ldehai 能否把你的相关配置参数文件提供下,只提供IP和端口相关的设置。如:gitlab.yml, gitlab-shell config.yml, unicorn.rb, resque.yml里的IP和端口、ssh key等参数设置。
    sarices
        10
    sarices  
       2015-01-22 22:40:37 +08:00
    https://github.com/gogits/gogs 不想折腾用这个,部署gitlab太虐了
    tekin
        11
    tekin  
    OP
       2015-01-22 22:53:28 +08:00
    @sarices 已经折腾这么久了,暂时不想放弃,先解决了gitlab问题,后面有空时好好体验下,谢谢推荐。
    lerry
        12
    lerry  
       2015-01-22 23:00:52 +08:00
    我是在一个纯净系统里用一键安装包安装的,简单配置后就可以用,用的挺好的
    安装包只能用在64位系统
    lerry
        13
    lerry  
       2015-01-22 23:02:11 +08:00
    @sarices 这个用过,但是感觉完成度和稳定性太低了,之前群组什么都用不了,好多操作都报500错误。
    RoshanWu
        14
    RoshanWu  
       2015-01-22 23:13:28 +08:00
    前些天刚给公司安装了个 Gitlab,现在用的正欢。希望对你有点帮助: http://git.cairenhui.com/gitlab/how-to-use/wikis/Generating-SSH-keys
    tekin
        15
    tekin  
    OP
       2015-01-22 23:34:46 +08:00
    @RoshanWu 谢谢,我先看看
    tekin
        16
    tekin  
    OP
       2015-01-22 23:35:54 +08:00
    @lerry 我系统已经部署了一些应用,暂时就手动安装看看,能否把你的相关配置参数给我们看看,如:gitlab.yml, gitlab-shell config.yml, unicorn.rb, resque.yml里的IP和端口、ssh key等参数设置。
    lerry
        17
    lerry  
       2015-01-23 00:12:13 +08:00
    我的就是默认配置,只是配置了域名、smtp、ldap,默认配置就可以跑的
    tekin
        18
    tekin  
    OP
       2015-01-23 00:57:37 +08:00
    @lerry 系统是centos吗?我也是默认配置,改了域名,但无法push,你的http还是https, ssh push正常吗?能Q远程看看吗?
    zcbenz
        19
    zcbenz  
       2015-01-23 01:30:36 +08:00 via iPhone
    人生苦短,还是用GitHub企业版吧。
    lyf362345
        20
    lyf362345  
       2015-01-23 02:06:50 +08:00
    看检查输出提示 gitlab shell 版本不对,你升级下看看,另外系统是什么系统,我最近 vps 干坏事被清空了,昨天花了半小时就装好了啊呀
    lyf362345
        21
    lyf362345  
       2015-01-23 02:10:19 +08:00
    @timsims 你是何zq 么 哈哈 猜猜我是谁
    tekin
        22
    tekin  
    OP
       2015-01-23 02:24:27 +08:00
    @lyf362345 系统是centos6,是按照官方教程一步步安装的,一次安装成功,但无法push、加我QQ
    lyf362345
        23
    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
        24
    kingme  
       2015-01-23 08:59:14 +08:00
    bitnami的一键安装包或者直接用部署好的虚拟机吧
    zzd1000
        25
    zzd1000  
       2015-01-23 09:14:55 +08:00 via iPhone
    看看你的文件夹权限 多了少了都不行
    L3ve
        26
    L3ve  
       2015-01-23 09:29:17 +08:00
    之前我也是搞了很久...之后发现是墙的问题...你试试看在DNS添加8.8.8.8
    sujin190
        27
    sujin190  
       2015-01-23 09:30:59 +08:00
    id_rsa.pub是直接authorized_keys文件的么?直接修改貌似不行,必须在gitlab中创建才行
    sujin190
        28
    sujin190  
       2015-01-23 09:39:31 +08:00
    gitlab-shell下面有push操作的日志,可以去看下
    lerry
        29
    lerry  
       2015-01-23 09:53:48 +08:00
    @tekin Debian wheezy 64位 http, push正常,你可以给我发邮件,看我资料页有邮箱地址
    zyAndroid
        30
    zyAndroid  
       2015-01-23 11:26:14 +08:00
    @timsims 正解,简单省心不折腾
    66450146
        31
    66450146  
       2015-01-23 11:34:40 +08:00
    折腾过两次,现在买了 GitHub 的服务,实在太麻烦了
    tekin
        32
    tekin  
    OP
       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
        33
    tekin  
    OP
       2015-01-23 12:01:08 +08:00
    /etc/hosts添加 127.0.0.1 localhost 就可以了、我先测试功能
    tekin
        34
    tekin  
    OP
       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
        35
    tekin  
    OP
       2015-01-23 15:10:35 +08:00
    总结一下:
    如果机器配置低bitnami的和别的一键安装可能不合适,低配置最好自己编译安装,有点麻烦,但还是能成功的。 谢谢大家总算成功了。版本问题和权限问题。目前只能是ssh方式可以了。
    tekin
        36
    tekin  
    OP
       2015-01-23 15:12:19 +08:00
    windows下 git bash响应很慢,是什么问题导致的,大家有遇到过吗?
    gevin
        37
    gevin  
       2015-01-23 15:56:17 +08:00
    我的GitLab装点docker版本,配置非常简单,推荐一下

    https://github.com/sameersbn/docker-gitlab
    tekin
        38
    tekin  
    OP
       2015-01-23 16:38:49 +08:00
    @gevin 我就一台VPS暂时不安装docker了,以后需要时看看,谢谢
    lostsnow
        39
    lostsnow  
       2015-01-23 17:31:21 +08:00
    还是用gogs吧, ruby这个坑货```
    mephisto
        40
    mephisto  
       2015-01-24 13:17:25 +08:00
    最多几个小时搞定, 官方不是有打好的包(rpm)吗?照着文档就能搞定(下包慢点)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3211 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 13:16 · PVG 21:16 · LAX 05:16 · JFK 08:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.