简体   繁体   English

Windows上的Git设置

[英]Git Setup on Windows

So on my friends local Windows machine we are trying to setup GIT. 因此,在我的朋友本地Windows计算机上,我们尝试设置GIT。

Basically, we've been following this guide which has been great. 基本上,我们一直在遵循这份很棒的指南 The problem we are facing is as follows: 我们面临的问题如下:

  1. All works until we get to Using Gitosis 所有的工作,直到我们进入“ 使用Gitosis”
  2. When we use the command 当我们使用命令

git clone git@INSERT_IP_HERE:gitosis-admin.git git clone git @ INSERT_IP_HERE:gitosis-admin.git

We keep getting 我们不断

Initialized empty Git repository in /home/Thomas/gitosis-admin/.git 在/home/Thomas/gitosis-admin/.git中初始化了空的Git存储库
Connection closed by IP_HERE IP_HERE关闭了连接
fatal: The remote end hung up unexpectedly 致命:远端意外挂断

When we try simply 当我们简单地尝试

ssh git@IP_HERE ssh git @ IP_HERE

We get "Connection closed by IP_HERE" 我们得到“ IP_HERE关闭连接”

If we login as 如果我们以

runas /user:git C:/cygwin/cygwin.bat Runas /用户:git C:/cygwin/cygwin.bat

And run > ssh git@IP_HERE 并运行> ssh git @ IP_HERE

We at least get asked for a password then 至少我们会要求输入密码

Last Login: Connection to IP_HERE closed. 上次登录:与IP_HERE的连接已关闭。

Would anyone be able to help ? 任何人都可以提供帮助吗?

The error does indeed indicate that authentication is failing. 该错误确实表明身份验证失败。

Firstly, open gitosis.conf on the server and check that you are a member of the group containing gitosis-admin repository. 首先,在服务器上打开gitosis.conf并检查您是否是包含gitosis-admin存储库的组的成员。 It should show something like. 它应该显示类似。

[gitosis]

[group gitosis-admin]
writable = gitosis-admin
members = user1 user2

The member name must match with a public key in /keydir before access can be made. 成员名称必须与/ keydir中的公钥匹配,然后才能进行访问。

Secondly, you do not say how you are connecting from the Windows machines. 其次,您不说如何从Windows计算机进行连接。 If you are using Git under Cygwin, make sure you are correctly loading the private key. 如果在Cygwin下使用Git,请确保正确加载了私钥。 If you are using MsysGit with Putty, be sure to load the private key before connecting as well. 如果您将MsysGit与Putty一起使用,请确保在连接之前也加载私钥。

There is a small gotcha if PuttyGen is used to generate key pairs, and that is the default format is different from OpenSSH which you are probably using. 如果使用PuttyGen生成密钥对,则会有一个小陷阱,这是默认格式与您可能使用的OpenSSH不同。 Copy and paste from the top window, or alternatively edit the multiline public key file to read like this. 从顶部窗口复制并粘贴,或者编辑多行公钥文件以读取如下内容。

ssh-rsa AAAABB...KEYBODY...ONLkQ== user1

Lastly, make sure port 22 is open in any firewalls if that is indeed the port you are using. 最后,如果确实是您正在使用的端口,请确保端口22在所有防火墙中都是打开的。

A more comprehensive description of how to set up a Git server with Gitosis on Windows, can be found at here 此处可以找到有关如何在Windows上使用Gitosis设置Git服务器的更全面的描述。

I recommend the use of MsysGit from windows, as it gives better integration into the Windows environment. 我建议从Windows使用MsysGit ,因为它可以更好地集成到Windows环境中。 TortoiseGit and GitExtensions both use MsysGit as the backend, and provide nice Gui's and explorer shell extensions. TortoiseGitGitExtensions都使用MsysGit作为后端,并提供了不错的Gui和explorer shell扩展。 GitExtensions full installer will provide the windows user with everything they need. GitExtensions完整安装程序将为Windows用户提供他们所需的一切。

Did you get past runnig the gitosis-init < /tmp/id_rsa.pub command? 您是否错过gitosis-init </tmp/id_rsa.pub命令?

That error indicates to me that the public key isn't set up properly. 该错误向我表明公钥设置不正确。 The command above initializes gitosis with the first key. 上面的命令用第一个键初始化gitosis。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM