我尝试在我的远程 git-server 上创建新的存储库
cd /var/www/vhost/example.com
sudo git init
sudo git remote add origin ssh://git@111.111.111.111:30000/home/git/repositories/example.git
sudo git add .
sudo git commit -a -m "Create empty example.com dir"
sudo git push origin master:refs/heads/master
我的 ssh 配置:
Host 111.111.111.111
User git
Port 30000
IdentityFile ~/.ssh/id_rsa
我的 gitosis-admin.conf
[gitosis]
[group gitosis-admin]
members = git@111.111.111.111
writable = gitosis-admin
[group example-com]
members = git@111.111.111.111 user@user
writable = example-com
获取错误
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
我可以
ssh git@111.111.111.111
没问题,但不能推。我做错了什么?我还研究了类似的先前问题GitHub:Permission denied (publickey)。致命:远程端意外挂断 ,但我不使用github。
更新:好的,我认为 sudo 有问题。
此命令完成但没有出现某种错误:
git push origin master:refs/heads/master
这个命令:
sudo git push origin master:refs/heads/master
完成错误:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly