这应该与您的 ssh 密钥格式有关,如该线程所示。
我PuttyGen
在 Windows 上使用生成我的公钥 ( SSH2 RSA 1024
) 并将其保存在本地,然后我将其上传到/tmp/id_rsa.pub
using 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/