Git在窗口,它是真正分布? [英] Git on windows, is it truly distributed?

查看:162
本文介绍了Git在窗口,它是真正分布?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始在Windows平台上使用git。我已 mysygit 安装,并禁用几个打嗝我很快就走了。

I am just starting out with git on the Windows platform. I have mysygit installed and bar a few hiccups I am 'git'ing away nicely.

但是,我必须缺少一些东西,因为我不明白在不同的Windows机器上的两个msysgit客户端如何可以直接推送和拉动。

However, I must be missing something because I don't understand how two msysgit clients on different Windows machines can push and pull to each other directly?

我是一个完整的linux noob,但我想我可以看到ssh的东西允许分发在linux上。但是,msysgit客户端仅显示为Windows cmd提示中的其他命令,并且没有Windows服务元素。

I am a complete linux noob but I think I can see that the ssh thing allows distribution on linux. However, the msysgit client appears just to be additional commands in the windows cmd prompt and there is no windows service element.

如果我尝试 git clone'MyMatesPc'谁将在另一端收听此请求?

If I try git clone 'MyMatesPc' who is going to be listening to this request at the other end?

我可以看到,如果你有一个'central'服务器在linux(或cygwin)上运行git,你可以通过将它们推送到'central'一个机器,然后将它们拉到另一个。

I can see that if you have a 'central' server running git on linux (or cygwin), you can share commits by pushing them onto the 'central' repo from one machine, then pulling them down onto another.

这实际上意味着您必须使用中央服务器。

This effectively means that you are having to use a central server.

我没有这个问题,但想检查我没有遗漏任何东西!

I don't have a problem with this, but wanted to check that I am not missing anything!

推荐答案

您可以使用 本地协议< a> :一个简单的共享路径就足够在同一个LAN上的两台PC上的两个Git存储库之间进行推/拉。

不需要(在这种情况下) 服务器。

You can use the local protocol: a simple shared path is enough for two Git repositories on two PC on the same LAN to push/pull from each other.
No need (in this case) for a "central" server.

作为 Noel Kennedy 在评论中指出,他在执行前必须将驱动器号映射到远程仓库: git clone file:/// z

这是最安全的路径,因为对于某些版本的msysgit,并不总是支持UNC路径。

As Noel Kennedy points out in the comments, he had to locally map a drive letter to the remote repo before executing: git clone file:///z.
That is the safest path, since UNC paths are not always supported with some versions of msysgit.

您可以使用UNC路径与最新的msysgit版本,一个Git bash会话:

You can use UNC paths with recent msysgit versions though, like in a Git bash session:

$ cd /c/temp
$ git clone //remote-host/share/path/to/repo.git

(注意' / '而不是Windows \ ')

(note the '/' instead of the Windows '\')

在DOS会话中,添加 mingw / bin 路径,它可能工作(即

In a DOS session, after adding the mingw/bin path, it might work too (i.e. using an UNC path instead of a mapped drive)

C:\temp>set PATH=%PATH%;c:\msysgit\bin;c:\msysgit\mingw\bin
C:\temp>git clone \\\\remote-host\\share\\path\\to\\repo.git






2014年8月更新(4年后),Git 2.1


Update August 2014 (4 years later), Git 2.1

由Eric Sunshine和 Cezary Zawadka提交c2369bd czawadka code>)表示更简单的UNC路径现在工作:

Commit c2369bd by Eric Sunshine and Cezary Zawadka (czawadka) means a simpler UNC path now work:


Eric Sunshine固定 mingw_offset_1st_component()一致返回 foo for UNC // machine / share / foo ,cf this thread

Eric Sunshine fixed mingw_offset_1st_component() to return consistently "foo" for UNC "//machine/share/foo", cf this thread.



So this should now work:

git clone //mymachine/shared/repo.git

这篇关于Git在窗口,它是真正分布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆