如何在windows中从局域网内的其他pc中克隆一个repo ?

时间:2022-09-30 01:24:40

I have this git repo "c:/xampp/htdocs/**" in my main PC and its IP address is 192.168.0.6. Now I want to git clone this repo from ubuntu-server which running on a Vmware Player in my main PC.

我有这个git repo“c:/xampp/htdocs/*”在我的主PC上,它的IP地址是192.168.0.6。现在我想要从ubuntu-server克隆这个repo,它在我的主PC上的一个Vmware播放器上运行。

I did

我所做的

 git clone \\192.168.0.6\c:\xampp\htdocs\****

and

 git clone //192.168.0.6/c:/xampp/htdocs/****

from ubuntu-server and neither worked.

来自ubuntu-server,两者都不起作用。

fatal: could not create work tree dir '****'.: Permission denied

What did I wrong? what should I do?

我错了吗?我应该做什么?

6 个解决方案

#1


20  

To access the repo, you must either share it on 192.168.0.6 or must be the same domain user as the one that owns the file on 192.168.0.6.

要访问repo,您必须在192.168.0.6*享它,或者必须与在192.168.0.6中拥有该文件的域用户相同。

If you share the directory on 192.168.0.6 (e.g. with share name myrepo), you access it with //192.168.0.6/myrepo.

如果您在192.168.0.6(例如,以共享名myrepo)上共享目录,则可以使用//192.168.0.6/myrepo访问该目录。

If you are logged in on your box with a user accout that is known on 192.168.0.6, you could try accessing the repo through the administrative shares:

如果你的邮箱是在192.168.0.6的用户帐户上登录的,你可以尝试通过管理股票访问回购:

//192.168.0.6/c$/xampp/htdocs/...

Always use forward slashes.

总是使用正斜杠。

Another alternative would be using SSH to access the remote machine.

另一种选择是使用SSH访问远程计算机。

#2


21  

Make sure that your c:/xampp/htdocs folder (or sub folders of it) is shared in windows, so you can navigate on the network by this address:

确保您的c:/xampp/htdocs文件夹(或它的子文件夹)在windows*享,以便您可以通过以下地址在网络上导航:

\\192.168.0.6\htdocs

Then you clone by using file:////. Note that there are four slashes:

然后使用文件:////。注意有四个斜杠:

git clone file:////192.168.0.6/htdocs/somerepo.git

#3


15  

You should use the command git daemon to host your repo, like this:

您应该使用命令git守护进程来托管repo,如下所示:

In your computer that will act as a server:

在您的计算机中,它将作为服务器:

git daemon --base-path=<path_to_folder_containing_project_folder> --export-all

git守护进程——基本路径= < path_to_folder_containing_project_folder >——导出所有

(please note that path_to_folder_containing_project is the folder containing your projects folders, it will provide all projects under that folder)

(请注意path_to_folder_containing_project是包含项目文件夹的文件夹,它将提供该文件夹下的所有项目)

In your client:

在您的客户端:

git clone git://<local ip>/<project name>

git克隆git:// <本地ip> / <项目名称>

The cloned repo will have its origin pointing to the server in your LAN, so you may want to use git remote set-url origin to point it to the original origin.

克隆的repo将其起源指向您的LAN中的服务器,因此您可能希望使用git远程set-url起源将其指向原始起源。

#4


2  

Using explorer (smb) to mount the remote repository as a network share is the easiest way. I'm not entirely sure, but I think you paths might be wrong. Try file:///192.168.0.6\c:\xampp... instead.

使用资源管理器(smb)将远程存储库作为网络共享挂载是最简单的方法。我不完全确定,但我想你的路径可能是错的。试文件:/ / / 192.168.0.6 \ c:\ xampp……代替。

There are two things that might have gone wrong for you:

有两件事可能会让你出错:

  • You don't have read permission on the remote repository
  • 远程存储库上没有读权限
  • You don't have write permission in the location you want to create your repository ( the current working directory or the directory you specify as second argument to git clone)
  • 在要创建存储库的位置(当前工作目录或git克隆的第二个参数指定的目录)没有写权限

And also check if your samba server works for normal file access.

还要检查您的samba服务器是否可以正常访问文件。

#5


1  

To make git repo on Windows local network you'd need to do the following:

要在Windows本地网络上创建git repo,您需要执行以下操作:

  1. Create new repo

    创建新的回购

    git init --bare projectName.git

    git init -裸projectName.git

  2. Share this folder (projectName.git) with the users you need

    与您需要的用户共享此文件夹(projectName.git)。

  3. Find your PC ip with ipconfig command (e.g. 192.168.2.101)
  4. 使用ipconfig命令查找您的PC ip(例如192.168.2.101)
  5. Run this command from some user's machine

    从某个用户的机器上运行此命令

    git clone //192.168.2.101/projectName.git

    git克隆/ / 192.168.2.101 / projectName.git

Note: open \\192.168.2.101 in finder to see the correct path to the projectName.git (e.g. //192.168.2.101/some/path/projectName.git)

注意:在finder中打开\192.168.2.101,查看到projectName的正确路径。git(例如:/ / 192.168.2.101 /一些/道路/ projectName.git)

#6


-2  

"I have a few different computers that I use at home and I wanted to set up GIT that I can access my code from any of them. It took me a bit because I was too used to working with a client-server model where I designate one machine as the "server" that holds the repository and everything else was a client. Instead, GIT seems to operate more like a merge tool and every local copy is its own "master." Once I understood that, it turns out that setting up GIT is very simple and just needs GIT itself and SSH".

“我有一些不同的电脑,我在家里使用,我想建立GIT,我可以从其中任何一台电脑访问我的代码。”我花了一点时间,因为我太习惯于使用客户机-服务器模型,在那里我指定一台机器作为保存存储库的“服务器”,而其他一切都是客户端。相反,GIT的操作更像是一个合并工具,并且每个本地副本都是它自己的“主”。一旦我理解了这一点,发现设置GIT非常简单,只需要GIT本身和SSH就可以了。

To read more you can check this link: http://blog.lazyhacker.com/2010/04/setting-up-git-for-home-network.html

要阅读更多内容,可以查看这个链接:http://blog.lazyhacker.com/2010/04/setting-upgit for home-network.html

#1


20  

To access the repo, you must either share it on 192.168.0.6 or must be the same domain user as the one that owns the file on 192.168.0.6.

要访问repo,您必须在192.168.0.6*享它,或者必须与在192.168.0.6中拥有该文件的域用户相同。

If you share the directory on 192.168.0.6 (e.g. with share name myrepo), you access it with //192.168.0.6/myrepo.

如果您在192.168.0.6(例如,以共享名myrepo)上共享目录,则可以使用//192.168.0.6/myrepo访问该目录。

If you are logged in on your box with a user accout that is known on 192.168.0.6, you could try accessing the repo through the administrative shares:

如果你的邮箱是在192.168.0.6的用户帐户上登录的,你可以尝试通过管理股票访问回购:

//192.168.0.6/c$/xampp/htdocs/...

Always use forward slashes.

总是使用正斜杠。

Another alternative would be using SSH to access the remote machine.

另一种选择是使用SSH访问远程计算机。

#2


21  

Make sure that your c:/xampp/htdocs folder (or sub folders of it) is shared in windows, so you can navigate on the network by this address:

确保您的c:/xampp/htdocs文件夹(或它的子文件夹)在windows*享,以便您可以通过以下地址在网络上导航:

\\192.168.0.6\htdocs

Then you clone by using file:////. Note that there are four slashes:

然后使用文件:////。注意有四个斜杠:

git clone file:////192.168.0.6/htdocs/somerepo.git

#3


15  

You should use the command git daemon to host your repo, like this:

您应该使用命令git守护进程来托管repo,如下所示:

In your computer that will act as a server:

在您的计算机中,它将作为服务器:

git daemon --base-path=<path_to_folder_containing_project_folder> --export-all

git守护进程——基本路径= < path_to_folder_containing_project_folder >——导出所有

(please note that path_to_folder_containing_project is the folder containing your projects folders, it will provide all projects under that folder)

(请注意path_to_folder_containing_project是包含项目文件夹的文件夹,它将提供该文件夹下的所有项目)

In your client:

在您的客户端:

git clone git://<local ip>/<project name>

git克隆git:// <本地ip> / <项目名称>

The cloned repo will have its origin pointing to the server in your LAN, so you may want to use git remote set-url origin to point it to the original origin.

克隆的repo将其起源指向您的LAN中的服务器,因此您可能希望使用git远程set-url起源将其指向原始起源。

#4


2  

Using explorer (smb) to mount the remote repository as a network share is the easiest way. I'm not entirely sure, but I think you paths might be wrong. Try file:///192.168.0.6\c:\xampp... instead.

使用资源管理器(smb)将远程存储库作为网络共享挂载是最简单的方法。我不完全确定,但我想你的路径可能是错的。试文件:/ / / 192.168.0.6 \ c:\ xampp……代替。

There are two things that might have gone wrong for you:

有两件事可能会让你出错:

  • You don't have read permission on the remote repository
  • 远程存储库上没有读权限
  • You don't have write permission in the location you want to create your repository ( the current working directory or the directory you specify as second argument to git clone)
  • 在要创建存储库的位置(当前工作目录或git克隆的第二个参数指定的目录)没有写权限

And also check if your samba server works for normal file access.

还要检查您的samba服务器是否可以正常访问文件。

#5


1  

To make git repo on Windows local network you'd need to do the following:

要在Windows本地网络上创建git repo,您需要执行以下操作:

  1. Create new repo

    创建新的回购

    git init --bare projectName.git

    git init -裸projectName.git

  2. Share this folder (projectName.git) with the users you need

    与您需要的用户共享此文件夹(projectName.git)。

  3. Find your PC ip with ipconfig command (e.g. 192.168.2.101)
  4. 使用ipconfig命令查找您的PC ip(例如192.168.2.101)
  5. Run this command from some user's machine

    从某个用户的机器上运行此命令

    git clone //192.168.2.101/projectName.git

    git克隆/ / 192.168.2.101 / projectName.git

Note: open \\192.168.2.101 in finder to see the correct path to the projectName.git (e.g. //192.168.2.101/some/path/projectName.git)

注意:在finder中打开\192.168.2.101,查看到projectName的正确路径。git(例如:/ / 192.168.2.101 /一些/道路/ projectName.git)

#6


-2  

"I have a few different computers that I use at home and I wanted to set up GIT that I can access my code from any of them. It took me a bit because I was too used to working with a client-server model where I designate one machine as the "server" that holds the repository and everything else was a client. Instead, GIT seems to operate more like a merge tool and every local copy is its own "master." Once I understood that, it turns out that setting up GIT is very simple and just needs GIT itself and SSH".

“我有一些不同的电脑,我在家里使用,我想建立GIT,我可以从其中任何一台电脑访问我的代码。”我花了一点时间,因为我太习惯于使用客户机-服务器模型,在那里我指定一台机器作为保存存储库的“服务器”,而其他一切都是客户端。相反,GIT的操作更像是一个合并工具,并且每个本地副本都是它自己的“主”。一旦我理解了这一点,发现设置GIT非常简单,只需要GIT本身和SSH就可以了。

To read more you can check this link: http://blog.lazyhacker.com/2010/04/setting-up-git-for-home-network.html

要阅读更多内容,可以查看这个链接:http://blog.lazyhacker.com/2010/04/setting-upgit for home-network.html