6

当我去设置 git 运行时ssh,我收到以下错误:

file "usr/lib/python2.5/site-packages/gitosis-0.2-py2.5.egg/gitosis/init.py", 
line 35, in ssh_extract_user 
_, user = pubkey.rsplit(None, 1)
ValueError: need more than 1 value to unpack

我输入的命令:

sudo -H -u git gitosis-init < /home/sean/.ssh/pubkey.pub

我正在运行 ubuntu 长版本服务器 8.04

4

3 回答 3

5

我通过修改生成的公钥文件解决了这个问题,最后它附加了用户名,删除了特殊字符并用 gitosis 注册了公钥。

如果公钥是

ssh-rsa AAAAB3NzaC1yc2E ....... ..... .....== user@3435-343-3434.somedomain.com

将此更新为

ssh-rsa AAAAB3NzaC1yc2E ....... ..... .....== user@somedomain.com

进一步参考https://bugzilla.redhat.com/show_bug.cgi?id=470359

于 2010-11-26T15:48:50.450 回答
4

这应该与您的 ssh 密钥格式有关,如该线程所示

PuttyGen在 Windows 上使用生成我的公钥 ( SSH2 RSA 1024) 并将其保存在本地,然后我将其上传到/tmp/id_rsa.pubusing pscp,但是当我运行

sudo -H -u git gitosis-init < /tmp/id_rsa.pub

我不断收到错误,例如:

gitosis.init.InsecureSSHKeyUsername: Username contains not allowed characters: ‘—‘

或者:

gitosis.init.InsecureSSHKeyUsername: Username contains not allowed characters:’”rsa-key-20081202”’

或(在我删除了文件中的所有内容但密钥本身之后):

ValueError: need more than 1 value to unpack

我认为它PuttyGen生成了SSH2一个格式略有不同的公钥文件,并且 '<code>git gitosis-init' 在开头想要一个用户名,所以我去了这里:

http://www.rfc-archive.org/getrfc.php?rfc=4716

并看到我可以保留“<code>-BEGIN...</code>”和“<code>-END”部分,并将“<code>comment: ...”行(由 PuttyGen 生成)替换为行阅读:

subject: git

它奏效了!我得到了输出:

Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/ 
Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
于 2010-02-19T08:21:58.910 回答
0

这把钥匙对我有用 puttygen on windows, ssh-2-rsa, 1024

ssh-rsa user@domain.com
AAAAB3N-lksdfwejekjvcjsndgefjhbdfzuegjksafdiuewhdskajdfeiudhksj
...
...
GncwFuk= 
于 2014-07-18T12:12:39.740 回答