2

I imagine that it is not a good practice to have your git repositories on a Google Drive mounted on Windows system because the infamous desktop.ini file will popup everywhere (here's a post of 2015).

When a team member tries to run the garbage collector (with or without prune: it doesn't make any difference) the below is the result:

git gc

Does anyone know how to prevent git to interpret the desktop.ini file as part of its config and reference files?

  • Note: please abstain to answer things like changing a registry entry, install this application/patch or disable this in windows settings. We assume we cannot get rid of the desktop.ini file. We just want to have things working normally even with its presence (if that could be possible).
rellampec
  • 698
  • 6
  • 22
  • 2
    The question that comes to my mind is why you'd *want* to use Google Drive to store a git checkout. Are you using it as the central git server to collaborate? If only some git commands error, maybe you could get away with storing a "bare" repository there, and then using `git clone`, `git push`, etc, in a normal directory, the same way you would with a more common setup. – IMSoP Feb 17 '21 at 08:38
  • @IMSoP well, that's what I do, and I would love that others followed this same practice as well. But I can't help others organising things their own way. So at least, I should try to help them to succeed in their deeds. And if that cannot be... a good answer here may persuade many to do not hang their cloned repos on Google Drive. May the Force be with us ;-) – rellampec Feb 17 '21 at 09:11
  • 2
    But I still don't understand why *anyone* would do this. The instructions "move your git checkout to another location" seem infinitely simpler than any answer here is likely to be, so there has to be some reason why that's not the solution. Is it for collaboration? Backups? – IMSoP Feb 17 '21 at 10:41
  • @CodeCaster not quite sure how that can help to clarify the question but a system is not supposed to add one file of its own to each folder as if it was the absolute owner of all the File System. We can start a discussion on this or just leave it there. – rellampec Feb 17 '21 at 19:07
  • @IMSoP I did not say that moving the git cloned repo to another location is not an acceptable answer. I said that it would be the only acceptable answer if there was no way to make `git` work with the `desktop.ini` file in there. – rellampec Feb 17 '21 at 19:10
  • 1
    @rellampec Well, proving a negative is hard, so you have to decide how much it's worth looking. As an exaggerated analogy, the answer to "How can I keep my hand in the oven without getting burned? Taking my hand out the oven is an option, but I'm curious if there's another way." would be "Just take your hand out of the oven." If the question was amended to "I want to leave my hand in the oven so that I can stop the sauce leaking from my casserole" the answer would be to find a better way to stop the sauce leaking, not a way to keep your hand in the oven. – IMSoP Feb 17 '21 at 19:14
  • @rellampec Regarding the suitability of the OS adding `desktop.ini` files - and I think this does relate to my previous point - by saying to Google Drive "use this part of the file system to synchronise copies of cloud storage", and also saying to git "use this part of the file system to store a version control database", you are giving control of the same resource to two different systems, with different requirements. Certainly, they _could_ be made to keep out of each other's way, but since it's not a use case either program envisaged, it's not all the surprising that _something_ goes wrong. – IMSoP Feb 17 '21 at 19:32
  • @IMSoP yeah, I agree with that observation. Nevertheless the `desktop.ini` files are added by Windows. Google Drive doesn't have anything to do with it. – rellampec Feb 17 '21 at 19:35
  • 1
    @rellampec alright, but the cause is Google Drive asking Windows to give each synced folder a nice overlay icon, and the OS has to store this info _somewhere_. I do agree that this shouldn't happen, but it's definitely Drive causing this file to exist. – CodeCaster Feb 17 '21 at 19:36
  • 1
    @CodeCaster alright... quotes removed at a petition of yours. – rellampec Feb 17 '21 at 19:37
  • @IMSoP in regard to your question _I still don't understand why anyone would do this_, I asked the team member and this is the answer: _it keeps my files out of my laptop, adding a layer of security to the data, provided that it is not stored locally_ (in case it was stolen or lost). – rellampec Feb 17 '21 at 20:08
  • Why don't you just add it to the .gitignore? – dan1st Feb 17 '21 at 20:15
  • 1
    @dan1st `desktop.ini` is already in `.gitignore` as you can imagine. The `.gitignore` file only refers to the repo data itself and its behaviour does not include the repo metadata and its management afaik. – rellampec Feb 17 '21 at 20:22
  • @IMSoP _The files are mirrored to Google Drive, but there is still a copy of every single one of them on the laptop_. That is only true if you have `offline` mode enabled (the default mode is `stream` only - [reference](https://support.google.com/a/answer/7491144)). Any way, soon enough there may be a policy to store all business data in Google Drive (in `stream`mode) for security reasons, which means that this question remains. Although I can use a hosted virtual Linux distro, that's not an option to all team members. – rellampec Feb 17 '21 at 21:01
  • @rellampec Well, you learn something every day; I've never used or come across that particular application, and was assuming it was like Dropbox, OneDrive, etc. In that case, you're going to have a whole new set of problems, because you're basically hosting random-access system files on a network drive, across the internet, using a protocol designed for document sharing. Accessing git over local SMB mounts is slow enough, I can't imagine what streaming every file access over an internet connection would be like. Once again, I'd be looking hard for alternative solutions to the security needs. – IMSoP Feb 17 '21 at 21:15
  • @IMSoP yeah, I don't like the Google Drive alternative either. It's just what seems easier & cheaper when it comes to engage the entire team to move the data out of their local drives. – rellampec Feb 17 '21 at 21:18
  • 1
    @rellampec And yet, here you are saying that it's **not** easy, because you've already run into problems with it, and I guarantee you will run into others. This is the very essence of an X/Y Problem: you're continuing down a dead end, and need to back up and look for solutions to the **real** problem. That's why I've been rather stubbornly insisting you describe that original problem. Note that the problem may also be how you're using **git**: maybe these files **should** be in Google Drive, but with the versioning managed there, not with git at all. – IMSoP Feb 17 '21 at 21:21
  • 2
    So the core problem is that your company doesn't want your employees to have code files or otherwise business-related files on their laptops, in case their laptops get stolen or lost. The _proper_ solution would be to use BitLocker or the likes, encrypting the entire disk. – CodeCaster Feb 18 '21 at 08:14
  • 1
    @CodeCaster thanks for your interest. Disc encryption has already been proposed. Not sure about the risks associated with this process, although we can guess. Anyways, at the end of the movie, it all goes to those who choose the tools. You choose Windows because... then you choose `git` because, and then you choose Google Drive because... and at the end, it all looks you just made one wrong decision: Google Drive? – rellampec Feb 18 '21 at 12:03
  • @rellampec Beware the sunk cost fallacy: just because you've spent time already setting up both git and Google Drive, doesn't mean the most efficient thing to do _now_ is to continue on that course. It's not too late to say "you know what, we don't need these files in git at all", or "actually, these users only rarely need to edit these files and could log into a remote server when they do", or even "we thought we had a solution, but it doesn't work, let's look around for other technologies and providers". – IMSoP Feb 19 '21 at 14:17
  • @CodeCaster _the cause is Google Drive asking Windows to give each synced folder a nice overlay icon_ -> do you have a reference to the above statement, I would like to dig deeper in there. Perhaps there is a configuration setting in Google Drive to stop that to happen. And if there isn't, perhaps the Google team could hear a feature request for this (you never know). – rellampec Feb 20 '21 at 00:35
  • @IMSoP (clever answer :) **working on remotes** is what some team mate and I **will be doing** for sure. Others will not (due to the nature of their core work). I am just looking for a smooth transition (and understand all your shared views) - I think it is `git` runner turn. Aside note: _basically hosting random-access system files on a network drive, across the internet, using a protocol designed for document sharing_ - besides `git` (checkouts), the rest of files are just _documents_ (the more technical team uses disk encryption on POSIX; this request belongs to the support team). – rellampec Feb 20 '21 at 00:45

0 Answers0