Using pre-existing local bare repositories?

I have some bare repos on local disk already, and developers with keys can work with them directly using ssh git urls.

I was hoping there was a way to get gitea to just adopt those bare repositories where they are, and users would then have a choice of either continuing to use their ssh urls as they have been doing, or using http urls from gitea, and pushes and pulls can be done using either mechanism.
(I don’t have root on this box so can’t have gitea binding 22 and anyway i’d rather not force people to give up their existing repo urls, just offer them an alternative).

But I’m finding little documentation from either gitea or gogs for this use case. I guess there is “New Repository” or “New Migration” (with or without mirror checked). But I’m not sure any of those match what I’m trying to do, nor whether what I’m trying to do is even possible - maybe gitea has hidden state somewhere in its db and can’t work with changes being applies directly to its repos.



Yes, on push, both through SSH and HTTP, there is some state that is modified outside of the actual repository, which is actually in the git hooks. You should:

  • Make a backup of your repos (just in case!)
  • Have the repository organized in a format similar to that of Gitea (username/repo.git in which there are the bare files)
  • Create the repositories from the web UI, under the usernames you have (they should git init --bare the repos, but not touch their contents)
  • From the admin page (avatar -> admin panel), run the Resync pre-receive, update and post-receive hooks of all repositories. task.
1 Like