Gitlab:未提供用户或 key

标签 git version-control gitlab

我试图将 master 分支从客户端推送到安装了 gitlab 的服务器。但是,我收到以下错误信息:

[root@warehouse git-sample]# git push origin master
git@192.168.7.82's password: 
Counting objects: 3, done.
Writing objects: 100% (3/3), 224 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: No user or key was provided.
To git@192.168.7.82:ite-pon/git-sample.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@192.168.7.82:ite-pon/git-sample.git'

看起来 gitlab 在项目中设置了预接收 Hook ,但阻止了推送操作。

有人知道如何处理这个问题吗?谢谢~:)

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

服务器和客户端的详细配置和信息如下:

服务器:GitLab & Git & 存储库信息

[root@warehouse git-sample.git]# pwd
/opt/gitlab/apps/gitlab/repositories/ite-pon/git-sample.git
  1. Gitlab 记录客户端的 ssh pub key (没有足够的信誉发送 图片 :()

  2. 将管理员(客户端用户)设置为该项目的主管,并作为 域的所有者。

服务器:配置

[root@warehouse repositories]# grep git /etc/passwd
git:x:502:502:Git:/opt/gitlab/apps/gitlab/repositories:/opt/gitlab/git/bin/git-shell

客户端:工作区信息

[root@warehouse git-sample]# pwd
/root/workspaces/git-sample/git-sample
[root@warehouse git-sample]# ls
readme.txt
[root@warehouse git-sample]# git branch
  dev
* master
[root@warehouse git-sample]# git remote -v
origin  git@192.168.7.82:ite-pon/git-sample.git (fetch)
origin  git@192.168.7.82:ite-pon/git-sample.git (push)

客户端:SSH 和 Git 信息

[root@warehouse git-sample]# git config --global user.name
Administrator
[root@warehouse git-sample]# git config --global user.email
admin@gitlab.xxxxxxxxxxx.com
[root@warehouse git-sample.git]# ls -l ~/.ssh/id_rsa.pub 
-rw-r--r-- 1 root root 413 7月   1 15:51 /root/.ssh/id_rsa.pub

最佳答案

看来您遇到了刚刚在 https://gitlab.com/gitlab-org/gitlab-ce/issues/2156 上记录的错误-- 解决方法是从服务器上的 authorized_keys 文件中删除 key 。

关于Gitlab:未提供用户或 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31162496/

相关文章:

GitLab:多项目管道中的作业工件

git - `git blame/annotate` : terminate on merge commits

Git 无法添加文件

Gitflow 和意外 merge 其他功能

git - 从 SVN 转换到 Git 时,如何将修订号放在提交消息中?

java - 在源代码中包含 SVN 修订号

version-control - TeamCity 可以从网络连接服务器获取源代码吗?

git - Jenkins 中多分支管道的 merge 请求触发器

windows - Windows 最常用的版本控制软件是什么?

python - 如何使用 python-gitlab 访问 gitlab api?