Cygwin/Git/Gitosis 无法推送新存储库
我最近在 Windows Server 2003 机器上设置了 cygwin、git 和 gitosis,但遇到了麻烦。我已经严格遵循了我能找到的所有教程,并确认当我推送 gitosis-admin 存储库时,我的 git 帐户的authorized_keys 表正在更新。然而,当涉及到创建新的存储库时,我似乎陷入了困境。
我看过很多推荐以下代码的教程(显然是存储库名称更改),在 git bash 和 windows 命令行中都进行了尝试:
mkdir free_monkey
cd free_monkey
git init
touch README
git add .
git commit -m "Added blank readme"
git remote add origin git@my_server:free_monkey.git
git push origin master
当我执行最后一行(无论我发送什么)时,它会显示“远程端意外挂断”: $ git push -v origin master:refs/heads/master 推送到 git@my_server:free_monkey.git 致命:远程端意外挂起
我的 gitosis.conf 文件如下所示:
[gitosis]
loglevel = DEBUG
[group gitosis-admin]
writable = gitosis-admin free_monkey.git free_monkey
members = git@my_server @all
如果我缺少任何您需要帮助我调试此问题的信息,请告诉我。谢谢你!
我关心的另一件事是:
$ ssh git@my_server git
DEBUG:gitosis.serve.main:Got command 'git'
ERROR:gitosis.serve.main:Unknown command denied
这可能是问题所在吗?如果是这样,我该如何解决这个问题?
I've recently set up cygwin, git, and gitosis on my Windows Server 2003 box and am having troubles. I've followed just about every tutorial I can find to the letter, and have confirmed that my git account's authorized_keys table is getting updated when I push the gitosis-admin repository. I seem to be stuck, however, when it comes to creating a new repository.
I've seen many tutorials that recommend the following code (obviously the repo name changes), tried in both git bash and windows command line:
mkdir free_monkey
cd free_monkey
git init
touch README
git add .
git commit -m "Added blank readme"
git remote add origin git@my_server:free_monkey.git
git push origin master
When I execute the last line (no matter exactly what I send), it says "The remote end hung up unexpectedly":
$ git push -v origin master:refs/heads/master
Pushing to git@my_server:free_monkey.git
fatal: The remote end hung up unexpectedly
My gitosis.conf file looks like the following:
[gitosis]
loglevel = DEBUG
[group gitosis-admin]
writable = gitosis-admin free_monkey.git free_monkey
members = git@my_server @all
Please let me know if I'm missing any information you need to help me debug this. Thank you!
One other thing that concerns me:
$ ssh git@my_server git
DEBUG:gitosis.serve.main:Got command 'git'
ERROR:gitosis.serve.main:Unknown command denied
Is that maybe the problem? If so, how do I fix that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能在第一次时犯了错字或其他原因。尝试删除原点并重新添加它:
然后再次尝试推送。值得一试。
You probably made a typo on the first time or something. Try removing the origin and re-adding it:
Then try pushing again. It's worth a try.
好吧,看来“未知命令被拒绝”错误是一个转移注意力的事情。出于安全原因,Gitosis 只允许在 git 推/拉过程中实际发送的命令,因此“git”不是已知命令。
我继续收到相同的错误,但偶然发现另一个论坛中对authorized_keys文件的引用 - 拥有重复的密钥会完全破坏authorized_keys文件。果然,这是我的问题。希望这对那里的人有帮助。
要真正诊断此问题,请按照以下步骤操作:
我现在可以通过 SSH 在我的服务器上运行 gitosis,可以通过 TortoiseGit 访问。
OK, so, it seems that the "Unknown command denied" error was a red herring. Gitosis only allows for the commands that actually get sent across during a git push/pull process for security reasons, so "git" was not a known command.
I continued receiving the same error, but stumbled-upon a reference to the authorized_keys file in another forum - having duplicate keys ruins the authorized_keys file completely. Sure enough, that was my problem. Hope this helps someone out there.
To really diagnose this, follow these steps:
I now have gitosis running on my server available over SSH, accessible via TortoiseGit.