简体   繁体   English

通过在线驱动器上的 WebDav 远程设置 git

[英]Set up a git remote through WebDav on an online drive

I have access to a drive that I would wish to use as a remote to backup some of my git repository.我可以访问我希望用作远程备份我的一些 git 存储库的驱动器。 I have two ways of accessing the drive.我有两种访问驱动器的方法。 The first one is using a normal internet browser (where it asks my username & password to get in).第一个是使用普通的互联网浏览器(它要求我的用户名和密码进入)。 The second one is through an option that the drive calls "remote access" which says I can access the drive through my computer using WebDav, where it lists the WebDav address, username and password.第二个是通过驱动器称为“远程访问”的选项,它表示我可以使用 WebDav 通过我的计算机访问驱动器,其中列出了 WebDav 地址、用户名和密码。

I managed to map the drive in the file explorer using this WebDav thing.我设法使用这个 WebDav 东西在文件资源管理器中 map 驱动器。 I just put on the WebDav address and then it asked me username and password.我只是输入了 WebDav 地址,然后它问我用户名和密码。

What I would like to do now is set up one of the folders in the drive as a remote in my git repository.我现在想做的是将驱动器中的一个文件夹设置为我的 git 存储库中的远程文件夹。 Preferably bypassing the mapped drive in the file explorer, since I'd have to map it every time I restart the computer.最好绕过文件资源管理器中的映射驱动器,因为每次重新启动计算机时我都必须 map 它。

Thank you very much for your help in advance.非常感谢您提前提供的帮助。

If you could map your drive in your local machine, then you could use a folder in that drive as a remote git repository by creating a bare repository如果您可以在本地计算机上 map 您的驱动器,那么您可以通过创建裸存储库将该驱动器中的文件夹用作远程 git 存储库

for doing that you have to select a folder in your WebDav drive and run:为此,您必须 select WebDav 驱动器中的文件夹并运行:

$ git init --bare

This will create an empty repository on that folder.这将在该文件夹上创建一个空存储库。 Then you can clone that repository by simply running:然后,您可以通过简单地运行来克隆该存储库:

$ git clone PATH_TO_THE_REPOSITORY 

and continue operating like a normal git repository并继续像普通的 git 存储库一样运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM