gitosis-init 错误 | 错误回溯(最近一次调用最后)

1 投票
1 回答
782 浏览
提问于 2025-04-18 15:54

大家好,我在设置gitosis的时候遇到了一些错误,我觉得可能是因为某些Python依赖没有安装。

这是我得到的输出:

git@ubuntu-server ~ % sudo -H -u git gitosis-init < /home/git/cs8898_windows7_21.07.2014.pub
Traceback (most recent call last):
  File "/usr/local/bin/gitosis-init", line 9, in <module>
    load_entry_point('gitosis==0.2', 'console_scripts', 'gitosis-init')()
  File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/app.py", line 24, in run
    return app.main()
  File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/app.py", line 38, in main
    self.handle_args(parser, cfg, options, args)
  File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/init.py", line 121, in handle_args
    user = ssh_extract_user(pubkey)
  File "/usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/init.py", line 39, in ssh_extract_user
    raise InsecureSSHKeyUsername(repr(user))
gitosis.init.InsecureSSHKeyUsername: Username contains not allowed characters: '----'

如果能给我一些提示就太好了,我也会自己尝试解决。

1 个回答

0

这个错误来自于 gitosis/init.py#L34-L39:

def ssh_extract_user(pubkey):
    _, user = pubkey.rsplit(None, 1)
    if ssh.isSafeUsername(user):
        return user
    else:
        raise InsecureSSHKeyUsername(repr(user))

这意味着你的公钥文件的内容不是 abcd...(长长的密钥)...xxxxx= 你的名字,而是在最后多了 ----

你需要清理一下这个文件的内容,或者重新生成你的密钥。

撰写回答