git clone无需输入用户密码 [英] git clone without asking for users password
问题描述
我想在我的专用服务器上创建公共git存储库,以供任何人克隆,但是它一直在询问我git用户的密码.
I want to create public git repository on my dedicated server for anyone to clone but it keeps asking me for password for git user.
我创建了名为git且没有密码的用户.已使用:
I have created user named git without password. Used:
passwd -d git
passwd -d git
不幸的是,每次我尝试做:
Unfortunately every time I try to do:
git clone git @ myhost:myrepo.git
git clone git@myhost:myrepo.git
我被要求输入密码.
我尝试在sshd_config
Match user git
PermitEmptyPasswords yes
PasswordAuthentication yes
对于PasswordAuthentication
,选择是和否,但仍然无效.
With either yes and no for PasswordAuthentication
but still no use.
推荐答案
似乎无法通过ssh进行.除非您复制公共密钥,否则它将始终要求输入密码.
It seems doing it over ssh is impossible. It will always ask for password unless you copy your public key.
解决方案是使用git daemon
并通过git://协议克隆存储库
The solution is to use git daemon
and clone repository over git:// protocol
git clone git://hostname/directory
有关它的更多信息,我建议git help daemon
For more information about it I suggest git help daemon
提示:
请记住,您需要赋予它读取权限.根据我设置其他人的经验:chmod -R o+r project.git
由于某些原因无法正常工作.您必须允许通过作者或组进行git访问.您可以在守护程序级别禁止对存储库的写访问(默认行为).
Tip:
Remember you need to give it read privileges. From my experience setting others: chmod -R o+r project.git
won't work for some reason. You have to permit git access via either author or group. You can disallow write access to your repo on daemon level ( default behaviour ).
这篇关于git clone无需输入用户密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!