Git 从另一个用户的工作目录中拉取

发布于 2024-10-10 13:52:51 字数 194 浏览 0 评论 0原文

是否可以使用其他用户的本地 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

非要怀念 2024-10-17 13:52:51

感谢 Rup 的回答和 eckes 的回答,到目前为止我已经得出以下结论:

您需要知道用户 PC 的 IP 地址 192.168.xx (这将是(下例中的),然后您需要在 Windows XP 中共享该文件夹。

  1. 右键单击要在用户 PC 上共享的所需文件夹,然后选择属性。
  2. 选择共享选项卡。
  3. 选择“共享此文件夹”并为该文件夹命名。这将是下面示例中的内容。
  4. 单击“确定”。

在您的 PC 上,您需要有一个已初始化的空 git 存储库,以便在拉取之前添加新的遥控器。

示例:

git init
git remote add <alias> //<ip_address>/<shared_folder_name>
git pull <alias> <branch>

上面的问题是它会复制共享文件夹的全部内容。我仍在寻找一种从另一个用户工作目录中提取单个文件的方法。

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.

  1. Right-click the desired folder you want to share on the users PC and select Properties.
  2. Select the Sharing tab.
  3. Select 'Share this folder' and give the folder a name. This will be the in the example below.
  4. Click OK.

On your PC you need to have an initialised and empty git repository for you to add the new remote before you pull.

Example:

git init
git remote add <alias> //<ip_address>/<shared_folder_name>
git pull <alias> <branch>

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.

眼中杀气 2024-10-17 13:52:51

是的,尽管这取决于您拥有的文件共享机制。默认情况下,您的其他用户几乎肯定不会通过 HTTP 托管其存储库,尽管您可以根据需要让他们进行设置。你可能想要做的是使用XP的文件共享,你可以通过IP来实现,即

git pull \\192.168.1.101\shared_directory\sandbox

如果设置了共享目录或者

git pull \\192.168.1.101\c$\full_path_on_c_drive\sandbox

没有共享目录但你对他们的机器有足够的访问权限。

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.

git pull \\192.168.1.101\shared_directory\sandbox

if there's shared directory set up or

git pull \\192.168.1.101\c$\full_path_on_c_drive\sandbox

if there's no shared directory but you have sufficient access rights to their machine.

聊慰 2024-10-17 13:52:51

作为 Rup 的答案的替代方案,您可以访问Windows 域框使用

git pull //hostname.domain/share/to/repo

其中 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

git pull //hostname.domain/share/to/repo

where repo is that folder that contains the .git directory. When pulling from a checked out working copy, you won't be able to push your changes back to the repo until a different branch is checked out on repo 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 on hostname.domain/share/to/repo. One workflow is to have an unused branch (e.g. called unused_branch) and check out this branch on hostname.domain before you push 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文