在gitlab配置完毕后,我们push一个repo,效果可能如下:

$ git push origin master:dev
enjoy code, enjoy life.
Total 0 (delta 0), reused 0 (delta 0)
remote: GitLab: An unexpected error occurred (redis-cli returned 1).
To git@xxx:root/my_project.git
 * [new branch]      master -> dev

这儿它提示得已经足够清楚,redis有问题.不过也再也找不到其它提示了. 处理方法就是修改配置文件,让redis能够连上去.

在~git/gitlab-shell 目录下有config.yml,配置的就是redis的连接方式.默认是config.yml.example copy过来的.

# Redis settings used for pushing commit notices to gitlab
redis:
  bin: /usr/bin/redis-cli
  #host: 127.0.0.1
  #port: 6379
  # pass: redispass # Allows you to specify the password for Redis
  database: 0
  socket: /var/run/redis/redis.sock # Comment out this line if you want to use TCP
  namespace: resque:gitlab

修改方法是反注释掉host和port,注释掉socket.修改后如下:

# Redis settings used for pushing commit notices to gitlab
redis:
  bin: /usr/bin/redis-cli
  host: 127.0.0.1
  port: 6379
  # pass: redispass # Allows you to specify the password for Redis
  database: 0
  #socket: /var/run/redis/redis.sock # Comment out this line if you want to use TCP
  namespace: resque:gitlab

注意三者都要搞好.我之前没有注释socket,错了好久都没过.

另外一个错误是

 git push origin master:dev
enjoy code, enjoy life.
/home/git/gitlab-shell/lib/gitlab_net.rb:140:in `read': No such file or directory - /home/git/gitlab-shell/.gitlab_shell_secret (Errno::ENOENT)
    from /home/git/gitlab-shell/lib/gitlab_net.rb:140:in `secret_token'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:85:in `http_request_for'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:96:in `request'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:119:in `post'
    from /home/git/gitlab-shell/lib/gitlab_net.rb:31:in `check_access'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:89:in `verify_access'
    from /home/git/gitlab-shell/lib/gitlab_shell.rb:29:in `exec'
    from /home/git/gitlab-shell/bin/gitlab-shell:20:in `<main>'
fatal: Could not read from remote repository.

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

原因是git-shell和gitlab本身的版本不一致.请查看官方版本.

Categories: Code

Yu

Ideals are like the stars: we never reach them, but like the mariners of the sea, we chart our course by them.

Leave a Reply

Your email address will not be published. Required fields are marked *