无法推送到BoxCryptor下的Dropbox中的Git存储库 [英] Can't push to Git repository in Dropbox under BoxCryptor
问题描述
首先,我的机器上有一个存储库,位于DropBox之外.接下来,我将存储库(裸露)克隆到DropBox内的一个文件夹中,该文件夹已由BoxCryptor加密.
Firstly, I have a repository on my machine, outside of DropBox. Next, I have cloned the repository (bare) and into a folder inside DropBox, which is being encrypted by BoxCryptor.
按照以下命令,这两个命令似乎都可以访问,并且可以正确地视为git存储库:
As per the following commands, both appear to be accessible and treated as git repositories correctly:
PS D:\MyProject> git remote -v
origin X:\Dropbox (Personal)\MyProject.git\" (fetch)
origin X:\Dropbox (Personal)\MyProject.git\" (push)
PS D:\MyProject> cd 'X:\Dropbox (Personal)\MyProject.git'
PS X:\Dropbox (Personal)\MyProject.git> git remote -v
origin D:\MyProject\ (fetch)
origin D:\MyProject\ (push)
但是,我无法从DropBox外部的文件夹推送到DropBox内部的文件夹:
However, I'm unable to push from the folder outside DropBox, to the folder inside DropBox:
PS D:\MyProject> git push origin master
fatal: 'Dropbox (Personal)\MyProject.git"' 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.
现在,我知道这不是权限问题-我对该文件夹具有写权限.当然,它是一个存储库,因为我可以在文件夹内运行git log
并查看日志.
Now I know it's not a permission problem - I have write access to the folder. And of course, it is a repository, because I can run git log
inside the folder and see the log.
我怀疑这可能与BoxCryptor发生的有趣事情有关.还是因为原始网址末尾有一个奇怪的额外双引号(在这种情况下,我该如何去除它?)?
I suspect it may either have to do with funny stuff going on with BoxCryptor. Or is it because of that weird extra double quote at the end of the origin url (in which case, how do I get rid of it?)?
推荐答案
我已解决了该问题-看来git在处理路径方面存在问题,无缘无故地添加了双引号.
I have fixed the issue - it appears to be that git is buggy in the way it deals with the path, appending the double quote for no reason.
首先,我尝试直接编辑.git\config
并删除双引号:
Firstly, I tried editing .git\config
directly and removing the double quote:
[remote "origin"]
url = X:\\Dropbox (Personal)\\MyProject.git\
fetch = +refs/heads/*:refs/remotes/origin/*
但是git对网址感到困惑:
However git became confused about the url:
fatal: 'X:\\Dropbox (Personal)\\MyProject.git fetch = +refs/heads/*:refs/remotes/origin/*' does not appear to be a git repository
接下来,我尝试在.git\config
中的行首添加双引号.但这也不起作用.
Next, I tried adding a double quote to the start of the line in .git\config
. But this didn't work either.
我可以通过创建没有空格的符号链接来解决此问题.
I could resolve the issue by creating a symbolic link that didn't have spaces.
最后,我弄清楚了-git不想在网址末尾加斜杠!删除双引号和斜杠可解决此问题:
Finally I figured it out - git doesn't want the slash at the end of the url! Removing the double quote and the slash fixes the problem:
[remote "origin"]
url = X:\\Dropbox (Personal)\\MyProject.git
fetch = +refs/heads/*:refs/remotes/origin/*
这篇关于无法推送到BoxCryptor下的Dropbox中的Git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!