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

发布于 2022-08-31 20:34:25 字数 5569 浏览 13 评论 0

按照官方教程安装成功、参考地址:
https://gitlab.com/gitlab-org...
但最后创建项目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.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

孤千羽 2022-09-07 20:34:25

外网能访问吗,能的话我帮你看看,我前几天也刚弄了一台

寄与心 2022-09-07 20:34:25

重新部署就好了、可能是权限问题。你的是ssh访问还是http访问,我的http不能push,超时,ssh可以push。

依 靠 2022-09-07 20:34:25

Gitlab搭建对环境配置要求比较高,我用7.9.2版本一切正常(除了手工修改了Web端口后,系统内部生成的链接记不住端口号,其他基本没出现什么bug)。建议楼主试试Gitlab新版本。

小姐丶请自重 2022-09-07 20:34:25

解决没?我貌似遇到你相同问题了,http不能push,ssh需要密码

混浊又暗下来 2022-09-07 20:34:25

这个问题其实是gitlab的一个bug,你到生成的ssh中将gitlab自动生成的command命令删除,只留下你自己添加的内容即可!

抚笙 2022-09-07 20:34:25

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

.pub文件 应该是从个人设置里添加的 ,而不是authorized_keys

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文