【发布时间】:2016-07-05 01:58:18
【问题描述】:
我想将我的 SSH 密钥添加到 git 服务器(公司服务器)上的授权密钥中,这样每次推送时都不必输入密码。但是由于某种原因,我无法使其正常工作。
我尝试了什么:
ssh-copy-id user@server
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
user@server's password:
fatal: unrecognized command '
umask 077 ;
mkdir -p .ssh && cat >> .ssh/authorized_keys || exit 1 ;
if type restorecon >/dev/null 2>&1 ; then restorecon -F .ssh .ssh/authorized_keys ; fi'
当我尝试 ssh 到 git 服务器时,我得到以下响应:
fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.
显然用户帐户正在使用git-shell,它似乎不理解通常的shell命令。
是否仍然可以以某种方式将公共 SSH 密钥添加到 git 服务器用户帐户?是否有一些 git 命令可以让我将我的公共 SSH 密钥添加到列表中?
我对 git 服务器的唯一访问是通过命令行,并且 GitWeb 界面正在运行(但在那里我也看不到任何安装 SSH 密钥的选项)。
【问题讨论】:
-
如果您只获得了 git-shell 访问权限,我想您将无法添加 ssh 密钥。您与公司的系统管理员/服务器维护人员谈过吗?
-
还没有,我试着先弄清楚这一点。但似乎没有其他选择,所以我会与他们核实。