Hosting a Git repository on Nextcloud

I would like to host one or more Git repositories on my Nextcloud instance.

I searched the Internet and started experimenting with Git HTTP protocol to push the repository. Unfortunately this didn’t work. I got an error (“error: no DAV locking support on …”).

Here is a support thread: Webdav - lock on file doesn't work - #2 by amcguinness
and a Github issue: WebDav file locking to prevent overwrites · Issue #1308 · nextcloud/server · GitHub discussing WebDAV file locking, with no statement if WebDAV locking will be supported or not.

Is there any other possibility, to host a Git repository on Nextcloud? (e.g. via SSH protocol)

1 Like

Well, not directly. But you could simply put the Git directory into a synced drive using the Nextcloud desktop client so it is the same on each machine (would recommend this only for single user operation). If you want a real Git server, then better use Gitlab/Gitea and so on, Nextcloud is not the right tool in that case.

We have a nextcloud running and it seems exactly the right tool to host private Git repositories. Why use something like bitbucket is my idea too. Is it not considered at all?


Nextloud is definitly not designed as a SCM tool (source code management).
What is your use case?

I was thinking about Supporting protocol-v2 next to webdav so we can share private repositories from NextCloud with external developers. We do this with ssh now and have no easy way to see who has rights to some repository from 2 years back. Mistakes are easily made in our current setup and I want to improve this. NextCloud provides us with the right sharing tools we also like to use for Git repositories.

You do have tolls to aid you in the git setup so that you know who has access to what with both private and public repositories. Like gitlab for example. Using nextcloud for it would not be optimal (unless someone decides to write an app for it :stuck_out_tongue:


This is old but it would be extremely cool if there would be a (very simple) git server in NextCloud, just for my personal code, no fancy features needed.

1 Like

Perhaps you can install git and then use “local” external storage in nextcloud.

1 Like


1 Like

I don’t think using Nextcloud for Source Code Management is a good idea.

Webdav and git both use https, but that does not mean they are compatible. You could upload a git repository on the nextcloud server, but git wouldn’t be aware of that.
Nextcloud by itself doesn’t support ssh, so no chance that will work.
A git server does much more that a webdav server.

Your best option is probably to use oder, or if you really want to host it yourself you could use Gitea or (if you have more that 8 GB of free memory) Gitlab.
All these options have many features a git over a Nextcloud app would never get like continuous integration.
The access control options wouldn’t be enough either, because you couldn’t protect branches …

Developing a nextcloud app for this purpose would not be a good idea, because there are already excellent options like github or gitlab.

I know all this, and I agree. But, a very simple way to back up my own code using Git to my own server would be so cool. I could also just sync a git repo using the sync client of course.

Anyway, I would not set up gitea or anything. But I’d use a simple nextcloud plugin a lot. I now use Gitlab but it is overkill for my simple home automation scripts.

I have git repos on the same server as Nextcloud and use ssh to access the git repos separate from Nextcloud. Works great and I see no benefit of further integrationm.