Clone git repo hosted on a Windows shared folder from Mac OS X

烂漫一生 提交于 2021-02-07 17:31:20

问题


I host a git remote repo on a Windows shared folder. I clone it using:

git clone //git-host-pc/SharedFolder/MyProject/

This command works from a Windows PC, but on a Mac, I get this error:

fatal: repository '//git-host-pc/SharedFolder/MyProject' does not exist

Trying git clone smb://git-host-pc/SharedFolder/MyProject gives me this error - fatal: Unable to find remote helper for 'smb'.

Note: I've found this question has been asked before mine - Use a git repos on a windows share from osx, however the OP there hasn't provided his exact commands, or the error messages, and that's why his question is unanswered.

Edit: I forgot to mention, but the shared folder is visible from the Mac, I can see it in Finder.


回答1:


I kind of like to think that remote file system access is an OS thing, and that cloning repos is an application-level thing, so this would be my approach:

You should just be able to mount that SMB share with your OS'es functions to a local directory and clone from there, instead of hoping git has a transport for SMB.

How to mount:

Connect to the server on your Mac. Now, on your Mac, from Finder's Go menu, choose "Connect to Server." Enter the IP address you just obtained from your PC, preceded by smb://, as shown:

UPDATE: To use your PC's name instead of IP address, replace the number with the name. So if your PC's name is "MyWindowsBox", you'd use smb://mywindowsbox (not case-sensitive).

If it finds your server, you'll get prompted to enter your network credentials - by default, your Windows username and password:

Where to find the mounted folder:

Once I mounted the //git-host-pc/SharedFolder in that way, I found it in /Volumes/SharedFolder.




回答2:


I've written this answer for those curious to know what git means by Unable to find remote helper for 'smb'

Git requires a helper program whenever it sees a URI such as ftp:// or smb://

When git encounters a URL of the form <transport>://<address>, where <transport> is a protocol that it cannot handle natively, it automatically invokes git remote-<transport> with the full URL as the second argument

Source: https://git-scm.com/docs/git-remote-helpers

Basically you do not have git remote-smb installed. You can use git help -a to see what helpers you have installed.

Until somebody writes a git remote-smb helper, it's probably best to just mount the drive you want as mentioned in another answer.



来源:https://stackoverflow.com/questions/32495503/clone-git-repo-hosted-on-a-windows-shared-folder-from-mac-os-x

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