【问题标题】:Bad configuration option in GIT (AllowUsers)GIT 中的错误配置选项(AllowUsers)
【发布时间】:2018-07-24 10:00:28
【问题描述】:

我正在尝试使用 gitlab 存储库中的 ssh 克隆一个项目,但问题是我不能这样做,因为消息 Permission denied: (publickey)

我已生成 ssh 密钥并添加到我的 gitlab 帐户,但没有成功。现在我正在尝试将配置文件添加到我的 ssh 文件夹中,如下所示:

Host gitlab.com
    User user
    Hostname gitlab.com
    IdentityFile ~/.ssh/id_rsa
    TCPKeepAlive yes
    IdentitiesOnly yes
    AllowUsers user

但是 GIT 说:Bad configuration option: allowusers

谁能解释一下为什么?

【问题讨论】:

  • 是从系统生成的 ssh 密钥,您尝试将其克隆到该系统吗?你是 sudo 用户吗?
  • 我正在使用 git bash 进行存储库克隆。我不能写 sudo -l 来检查我是否是 sudo 用户... :(

标签: git ssh gitlab config


【解决方案1】:
Host gitlab.com
    ...
    AllowUsers user

从您的 .ssh/config 文件中删除“AllowUsers”行。 ssh 接受的参数描述为here,“AllowUsers”不是其中之一。

“AllowUsers”是可以在OpenSSH server configuration中设置的参数。在你的例子中,这里的服务器是 gitlab.com,即使假设他们使用的是普通的 OpenSSH 服务器,你几乎肯定没有能力或不需要重新配置 Gitlab 的服务器。

【讨论】:

  • 尝试创建一个新的sshd_config文件并添加一行AllowUsers user,但仍然有公钥问题。你有什么建议吗?
  • 我的建议是您从 ssh 配置中删除“AllowUsers”并忘记它。你为什么要首先设置 AllowUsers ?这是你在服务器上设置的东西,在这种情况下 Gitlab 就是服务器。
  • 如果您遇到“公钥问题”,这是一个单独的问题,您应该提出一个新问题。
  • 根据 Kenster 的回答,我收到此错误是因为我不小心将 AllowUsers 子句放在 /etc/ssh/ssh_config 而不是 /etc/ssh/sshd_config 它所属的位置。 AllowUsers 子句是为了防止未经授权的人登录我的机器,但我把它放在错误的地方,因此得到了这个问题中提到的 Git 错误。
猜你喜欢
  • 1970-01-01
  • 2021-10-30
  • 2020-08-01
  • 2016-09-12
  • 1970-01-01
  • 2013-04-13
  • 1970-01-01
  • 1970-01-01
  • 2013-10-06
相关资源
最近更新 更多