Git 从另一个用户的工作目录中拉取
是否可以使用其他用户的本地 IP 地址从其他用户的工作目录中提取特定文件或更改?
例如,
git pull http://192.168.1.101/sandbox/somefile.php
应该注意的是,两个用户都使用Windows XP。
谢谢,
P。
Is it possible to pull specific files or changes from another users working directory using thier Local IP address?
e.g.
git pull http://192.168.1.101/sandbox/somefile.php
It should be noted that both users are using Windows XP.
Thanks,
P.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
感谢 Rup 的回答和 eckes 的回答,到目前为止我已经得出以下结论:
您需要知道用户 PC 的 IP 地址
192.168.xx
(这将是(下例中的),然后您需要在 Windows XP 中共享该文件夹。在您的 PC 上,您需要有一个已初始化的空 git 存储库,以便在拉取之前添加新的遥控器。
示例:
上面的问题是它会复制共享文件夹的全部内容。我仍在寻找一种从另一个用户工作目录中提取单个文件的方法。
Thanks to the response of both Rup's answer and eckes's answer, I've come up with the following so far:
You'll need to know the IP address of the users PC
192.168.x.x
(this will be the in the example below) and then you'll need to share the folder in Windows XP.On your PC you need to have an initialised and empty git repository for you to add the new remote before you pull.
Example:
The problem with the above is that it will copy the entire contents of the shared folder. I am still looking for a way to pull an individial file from another users working directory.
是的,尽管这取决于您拥有的文件共享机制。默认情况下,您的其他用户几乎肯定不会通过 HTTP 托管其存储库,尽管您可以根据需要让他们进行设置。你可能想要做的是使用XP的文件共享,你可以通过IP来实现,即
如果设置了共享目录或者
没有共享目录但你对他们的机器有足够的访问权限。
Yes, although it'll depend on what file sharing mechanisms you have. Your other user almost certainly won't be hosting their repository over HTTP by default, although you could have them set this up if you want. What you probably want to do is use XP's file sharing which you can do via IP, i.e.
if there's shared directory set up or
if there's no shared directory but you have sufficient access rights to their machine.
作为 Rup 的答案的替代方案,您可以访问Windows 域框使用
其中
repo
是包含.git
目录的文件夹。从签出的工作副本中提取时,您将无法将更改推送回存储库,直到在存储库
上签出与您的分支不同的分支。想要推到。因此,如果您拉取并希望将更改推送回分支
master
,则在hostname.domain/share/to/repo< 上检出另一个分支之前,您将无法推送更改/代码>。一种工作流程是拥有一个未使用的分支(例如,称为
unused_branch
),并在推回
更改之前在hostname.domain
上检查此分支。更干净的替代方案是在您和其他用户可以访问的计算机上拥有一个裸存储库。在这种情况下,您可以
push
而无需之前签出另一个分支,因为裸存储库没有签出的工作副本。As an alternative to Rup's answer, you could access windows domain boxes using
where
repo
is that folder that contains the.git
directory. When pulling from a checked out working copy, you won't be able topush
your changes back to the repo until a different branch is checked out onrepo
as that one you want to push to.So, if you pulled and want to push changes back to branch
master
, you won't be able to push until another branch is checked out onhostname.domain/share/to/repo
. One workflow is to have an unused branch (e.g. calledunused_branch
) and check out this branch onhostname.domain
before youpush
your changes back.The cleaner alternative would be to have a bare repo on a computer that you and the other users have access to. In that case, you can
push
without having to check out another branch before since bare repos have no checked out working copy.