Cannot git clone to VMWare shared folder

余生长醉 提交于 2019-11-30 13:08:16

问题


Weird problem this morning - I'm not able to git clone from a public repo on GitHub to my shared VMWare folder with either SSH or HTTPS. I'm working on Fedora 22, and if I try this command anywhere on the system other than the shared folder, it works perfectly.

git clone https://github.com/twbs/bootstrap.git
Cloning into 'bootstrap'...
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Steps I have tried:

  • Rebooting VM and host Mac (running El Capitan)
  • Reinstalling git
  • Checking permissions (drwxr-xr-x)

Does anyone have any idea why the shared folder might be causing this?


回答1:


I have the same issue. I believe this may be because the VMWare shared folder filesystem does not support all filesystem operations properly. For instance, you cannot create a hardlink:

$ touch foo
$ ln foo bar
ln: bar: Operation not supported

... and you cannot copy a symlink:

$ touch foo
$ ln -s foo bar
$ cp -R bar baz
cp: bar: could not copy extended attributes to baz: Invalid argument

Furthermore, once the git clone fails, the filename of the checkout can never be used again:

$ git clone https://github.com/twbs/bootstrap.git
Cloning into 'bootstrap'...
[...]
fatal: index-pack failed
$ touch bootstrap
touch: bootstrap: Input/output error

Others have noticed the issues with hardlinks and git clone in VMWare shared folders. Nobody has found a solution.

I have worked around this issue when using an OS X guest by saving a disk image to the shared folder, mounting the disk image in the guest, and then git-cloning into the mounted filesystem. A similar technique may work in Linux, but I haven't tried it.




回答2:


As Laurence pointed out, this is an issue from VMWare version 0.6.0. This is because:

VMware changed the tools package and moved from HGFS to FUSE instead of being in the kernel.

There are no folders under /mnt/hgfs and shared folders are created under a folder named shared_folder.

Symptoms:

  • Cannot access a shared folder in a virtual machine from other machines in the network.
  • A shared folder with appropriate permissions in a virtual machine is not accessible over the network

The error similar to:

You cannot access ip_address\folder_name
You do not have permission to access ip_address\folder_name. Contact your network administrator to request access.

Cause:

As far as I see, this is the reason behind this issue and other bugs related to other filesystem operations. More appropriately,

This issue occurs if the Audit object access GPO is enabled on the shared folder and the shared folder resides on a hot-pluggable device.

Solution:

Mount shared folders. Refer this

Locate the shared folders.

Disable audit file access on the shared folder and remove all hot-pluggable devices.

Hope this will help.

Few months ago, my development team faced a similar issue regarding which a colleague contacted the support team on behalf of the organization.

Alvaro Aguilera from Hashicorp support was gracious enough for pointing out the issue. Initially, the support team had suggested to move to Fusion 8.0.2 which also works in case one wants to avoid the hassle.

Following is the concluding message from the support team on 20th May 2016:

Thanks for reaching out to us.

As per the log, it seems the HGFS module is not present on the VM.

Additionally, there is a VMWare fusion issue with 8.1.* and forwarded ports, please try to go to Fusion 8.0.2 since that is the last one known to work without issues.

Please use old boxes for your use case instead of the latest VMware Fusion as the developer team has confirmed that it is expected to be solved in Q1 2017.

Thanks for understanding.

We had moved to Fusion 8.0.0 and this issue was solved.




回答3:


I found the fix today. Not sure if it is the same for everyone - but you need to configure your VM sync folder to use smb and also mfsymlinks

config.vm.synced_folder ".", "/vagrant", type: "smb", mount_options: ['vers=3.02', 'mfsymlinks']

I can now use Git and symlinks correctly inside the VM without issue.




回答4:


Here is my solution. Since in VMware Machine can't git clone, and when use other commands, it may cause problems. So I git clone in windows systems, and do my git jobs in my windows system. And it works for me.




回答5:


I do not have a relevant setup here, so I might get wrong, but - you say that the problem only happens on shared folders. One option I might think of is that SSH/HTTPS uses a different key than your own when on such a folder.

If this is the case, a possible solution is to define keys for whoever is considered by VMWare as the user.

BTW, have you tried cloning a repository to a private folder and then sharing it? It is interesting whether it will work that way (which might indicate that the problem only happens upon local creation of the folders) or fail with a similar or different error when trying to further pull or push (which might indicate that the problem is in the connection itself, but not necessarily).




回答6:


I had the same issue but i found a solution. My setup is using VMware Workstation 12.5.5 and Linux kernel 4.4 for the guest.The host runs Linux kernel 4.10.8. You need to git clone the latest openvm-tools in your Linux guest under $HOME (not under your HGFS mount directory of course): https://github.com/vmware/open-vm-tools

follow the instructions and compile openvm-tools from the source.After compiling, backup /usr/bin/vmhgfs-fuse (cd /usr/bin; mv vmhgfs-fuse vmhgfs-fuse.bak) and copy $HOME/open-vm-tools/open-vm-tools/vmhgfs-fuse/.libs/vmhgfs-fuse to /usr/bin.

Then copy $HOME/open-vm-tools/open-vm-tools/libvmtools/.libs/libvmtools.so.0.0.0 to /lib64 and create a link to it: ln -s libvmtools.so.0.0.0 libvmtools.so.0

Check for other libraries that could be needed. (use ldd /usr/bin/vmhgfs-fuse to know which libraries are missing and copy accordingly)

That's it, reboot the vmware guest machine and you will be able to use your hosts mounted directory via HGFS to store Git repositories, clone, pulls, pushes are working fine now :)




回答7:


I have found a workaround for this issue, share a folder from windows and then in your linux guest intall samba and cif-utils You can then mount the share by ip of the host like this

(add this line to your fstab)

//YOUR_HOST_IP/share /PATH_TO/GUEST_SHARE cifs user,noperm,rw,username=YOURUSERNAME,password=YOURPASSWORD 0 0

the key here is the noperm designation

note: for security purposes you can store your windows password in a credentials file and call it here or create a user on your windows instance that is designated only for share access and then grant access on your primary user account to the share user.

Hope this helps.

GIT CLONE TO YOUR HEARTS DESIRE



来源:https://stackoverflow.com/questions/33393077/cannot-git-clone-to-vmware-shared-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!