升级到 Ubuntu 16.10 后,我无法通过 ssh 克隆 Gitlab 中提供的存储库。如果我使用
git clone [email protected]:user_name/repo_name.git
命令,我得到这个:
~/.ssh/config: line 8: Bad configuration option: Identityfile
~/.ssh/config: terminating, 1 bad configuration options
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
如果我注释掉Identityfile
一行并运行相同的命令,我会得到这样的结果:
debug1: Reading configuration data ~/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
/etc/ssh/ssh_config: line 55: Bad configuration option: gssapIauthentication
/etc/ssh/ssh_config: line 56: Bad configuration option: gssapIdelegatecredentials
/etc/ssh/ssh_config: terminating, 2 bad configuration options
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
为了确保错误与我的调整无关,我检查了 Ubuntu 16.10 中 openssh-client 的选项是否gssapIauthentication
为默认选项,结果发现这些选项是默认选项。事实上,我没有在 /etc/ssh/ssh_config 文件中调整任何内容。gssapIdelegatecredentials
这些是 /etc/ssh/ssh_config 文件中未注释的选项:
Host *
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
如果我命令Identityfile
、GSSAPIAuthentication
和GSSAPIDelegateCredentials
选项,我可以通过 ssh 克隆我的存储库。
这是我的 ~/.ssh/config 文件:
Host gitlab
Hostname gitlab.com
RSAAuthentication yes
IdentityFile ~/.ssh/id_rsa
User user_name
openssh_client 版本:
LC_ALL=C apt-cache policy openssh-client
openssh-client:
Installed: 1:7.3p1-1
Candidate: 1:7.3p1-1
Version table:
*** 1:7.3p1-1 500
500 http://archive.ubuntu.com/ubuntu yakkety/main amd64 Packages
100 /var/lib/dpkg/status
我该如何解决这个问题?什么可能导致这个问题?问题的根源是 Gitlab 吗?
先感谢您。
PS:我的母语不是英语。
编辑
@zwets 的回答虽然没有解决问题,但是给了我一个提示:
这可能是字符编码问题吗?
因此我按如下方式运行命令:
LC_ALL=C git clone [email protected]:user_name/repo_name.git
并且成功了。但是这个解决方法表明 Ubuntu 16.10 中的 openssh-client 包存在错误。我会打开一个错误报告。
编辑2
我报告了 Launchpad 中的一个错误,这是报告的链接:https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1638338
命令输出locale
:
locale
LANG=tr_TR.UTF-8
LANGUAGE=tr:en
LC_CTYPE="tr_TR.UTF-8"
LC_NUMERIC=tr_TR.UTF-8
LC_TIME=tr_TR.UTF-8
LC_COLLATE="tr_TR.UTF-8"
LC_MONETARY=tr_TR.UTF-8
LC_MESSAGES="tr_TR.UTF-8"
LC_PAPER=tr_TR.UTF-8
LC_NAME=tr_TR.UTF-8
LC_ADDRESS=tr_TR.UTF-8
LC_TELEPHONE=tr_TR.UTF-8
LC_MEASUREMENT=tr_TR.UTF-8
LC_IDENTIFICATION=tr_TR.UTF-8
LC_ALL=
命令输出sed -n 8p ~/.ssh/config | od -t d1
:
0000000 9 85 115 101 114 32 110 117 109 97 110 100 10
0000015
编辑3
输出file ~/.ssh/config
/home/numand/.ssh/config: ASCII text
iconv -t ascii -o /dev/null ~/.ssh/config
命令不返回任何内容。