CLI command to trigger repo garbage collection #4968

Closed
opened 2025-11-02 06:09:28 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @silverwind on GitHub (Feb 28, 2020).

The UI button for repo garbage collection is not really usable as the operation seems to run for like 30 minutes with the browser stuck in the POST request with a moderate amount of repos present. I'd like to see a CLI command to trigger garbage collection on all repos (maybe also accept single repo argument) with some progress feedback on the CLI itself.

Would solve https://github.com/go-gitea/gitea/issues/7436 for me.

Originally created by @silverwind on GitHub (Feb 28, 2020). The UI button for repo garbage collection is not really usable as the operation seems to run for like 30 minutes with the browser stuck in the POST request with a moderate amount of repos present. I'd like to see a CLI command to trigger garbage collection on all repos (maybe also accept single repo argument) with some progress feedback on the CLI itself. Would solve https://github.com/go-gitea/gitea/issues/7436 for me.
GiteaMirror added the type/enhancement label 2025-11-02 06:09:28 -06:00
Author
Owner

@silverwind commented on GitHub (Feb 28, 2020):

I wonder if it is generally safe to manually run git gc inside each repo directory.

@silverwind commented on GitHub (Feb 28, 2020): I wonder if it is generally safe to manually run `git gc` inside each repo directory.
Author
Owner

@guillep2k commented on GitHub (Feb 28, 2020):

I was under the impression that git gc was moved to queues... 😅

@guillep2k commented on GitHub (Feb 28, 2020): ~~I was under the impression that `git gc` was moved to queues...~~ 😅
Author
Owner

@guillep2k commented on GitHub (Feb 29, 2020):

I was under the impression that git gc was moved to queues...

It wasn't. Maybe it's better to use a queue than a cli command?

About performing the git gc action from command line, according to this it should be safe. The question is about Windows UNC paths, but the answers are not specific.

@guillep2k commented on GitHub (Feb 29, 2020): > > > I was under the impression that `git gc` was moved to queues... It wasn't. Maybe it's better to use a queue than a cli command? About performing the `git gc` action from command line, [according to this](https://serverfault.com/questions/482349/is-it-safe-to-use-git-with-multiple-users-when-the-repository-is-on-a-windows-fi) it should be safe. The question is about Windows UNC paths, but the answers are not specific.
Author
Owner

@lunny commented on GitHub (Feb 29, 2020):

All operations on admin panel should be as a task on queue. And these tasks could be tracked.

@lunny commented on GitHub (Feb 29, 2020): All operations on admin panel should be as a task on queue. And these tasks could be tracked.
Author
Owner

@silverwind commented on GitHub (Feb 29, 2020):

It'd be great if there were at least some kind of feedback/progress info on the UI for the admin tasks. Clicking the GC button and having the browser stuck in a POST for 30+ mins is not very user-friendy.

About performing the git gc action from command line, according to this it should be safe

My question was more specific to gitea, e.g. does gitea need to clean any caches when I perform a manual git gc on a repo or is all repo data queried live? I guess certain git operations might fail during a gc operation when refs are being rewritten, but that is to be expected.

@silverwind commented on GitHub (Feb 29, 2020): It'd be great if there were at least some kind of feedback/progress info on the UI for the admin tasks. Clicking the GC button and having the browser stuck in a POST for 30+ mins is not very user-friendy. > About performing the git gc action from command line, according to this it should be safe My question was more specific to gitea, e.g. does gitea need to clean any caches when I perform a manual `git gc` on a repo or is all repo data queried live? I guess certain git operations might fail *during* a `gc` operation when refs are being rewritten, but that is to be expected.
Author
Owner

@zeripath commented on GitHub (Mar 6, 2020):

This could be added to the manager subcommand.

In general some of our gitea admin commands likely need to be adjusted to have the option to talk to a running gitea server rather than touch the database directly.

@zeripath commented on GitHub (Mar 6, 2020): This could be added to the manager subcommand. In general some of our gitea admin commands likely need to be adjusted to have the option to talk to a running gitea server rather than touch the database directly.
Author
Owner

@guillep2k commented on GitHub (Mar 6, 2020):

In general some of our gitea admin commands likely need to be adjusted to have the option to talk to a running gitea server rather than touch the database directly.

I agree. That will cause problems sooner or later otherwise.

@guillep2k commented on GitHub (Mar 6, 2020): > In general some of our gitea admin commands likely need to be adjusted to have the option to talk to a running gitea server rather than touch the database directly. I agree. That will cause problems sooner or later otherwise.
Author
Owner

@silverwind commented on GitHub (Mar 6, 2020):

Yeah I guess it should talk to the API instead of modifying fs/db.

Regarding this PR, I think I may just be happy with https://github.com/go-gitea/gitea/pull/10629 if I get some feedback on gc on the UI.

@silverwind commented on GitHub (Mar 6, 2020): Yeah I guess it should talk to the API instead of modifying fs/db. Regarding this PR, I think I may just be happy with https://github.com/go-gitea/gitea/pull/10629 if I get some feedback on gc on the UI.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4968