How do you manage git repos inside Nextcloud two-way synced files?

Hi! I recently wanted to move all my project files to a Nextcloud instance. The issue is that most of my projects contain some sort of git repository. As I understand it is not advised to sync git repositories to Nextcloud due to potential conflicts as well as unnecessary syncs when checking out an old branch for example.

Essentially, my folder structure is like this

Documents/
|-- Projects/
    |-- project-a/
        |--repo/
        |-- other-files/
    |-- project-b
        |--repo/
        |-- other-files/

I can avoid syncing the repos with a simple ignore pattern in the nextcloud desktop app.[1] However, this leaves empty gaps when for example opening on a new machine. Ideally there would be something that can automatically recreate the repositories from something that can be synced with Nextcloud.

My question is What do you use to manage git repos inside the wider synced structure? I have looked at tools such as vcs2l, gita, and myrepos. I am not sure which one is the best, so I want to ask if anyone has a similar situation to mine and how they solved it.

Best regards,
Lukas

  • Nextcloud Server version (e.g., 29.x.x):
    • 34.0.3
  • Operating system and version (e.g., Ubuntu 24.04):
    • NixOS 26.05

  1. Side-question: Is this persistent across devices? ↩︎

Hello @lejvin, welcome to the Nextcloud community! :handshake:

I don’t get point of placing git repo into Nextcloud folder.. your Git server should be the sync instance as it knows who to handle it best. Nextcloud might handle it as well but it would for example pollute your activity history (and audit logs) with meaningless records.. at the same time syncing the same file set to two different targets (Nextcloud and Git server) is really is definitely nothing both systems are designed for.. I would not recommend such config with any case of sync software.

Thank you for the welcome!

I think you misunderstood my post. I have no plan to sync git repos. In fact, that is exactly what I am trying to avoid. As I said:

As I understand it is not advised to sync git repositories to Nextcloud due to potential conflicts as well as unnecessary syncs

My aim is to keep my git repository folders inside the same folder structure as my overall Nextcloud sync files. The purpose of this is have all files related to a certain project in a single place.

In order to do this I would like to be able to automatically pull/clone all repos in to their respective places using a manifest file that would be synced to Nextcloud. I was wondering if anyone uses a similar workflow and what tool they used to achieve it. This weekend I plan to spend some time configuring it. I will post here what solution I end up going with.

In fact it seems I have different understanding of a Git repo.. In my understanding this is not a semi-static list of files but rather living structure which is updated from time to time (especially the tools you referred to connect/translate multiple source control systems) at the same time you mention other Nextcloud client instances:

all this factors together could result in unpredictable changes and brake the sync.

I would say as long you simply place static snapshot of a project on Nextcloud folder (git clone) for archive or similar purposes and don’t actively work on this files - it should be fine and behave like any other files collection. If you plan active work on this replica and connect to central Git server “here be dragons”