Dirichlet
Dirichlet

Reputation: 43

How to clean a remote GIT repository?

I've a hosted GIT repository with limited disk space available but connected with a RedMine system. I'm packaging some software and pushing and pulling on the repository, I'm run out of space. Now I need to clean (the packages are note needed anymore). How can I delete these packages from the remote repository history, considering that I cannot re-create the repository (it's too strictly linked to RedMine)?

Upvotes: 4

Views: 3302

Answers (2)

svick
svick

Reputation: 244757

You can use git rebase -i to “squash” some commits together, so that the intermediates won't be in the repository anymore, and then git push -f it onto the server. But rebasing causes problems if others use the same repository.

Also, the original revisions and files associated with them will be actually deleted from the repository only after garbage collection is done (I think you can't do that remotely, but it should happen automatically) and they are no longer referenced from the reflog (entries stay there 90 days on default).

Upvotes: 0

VonC
VonC

Reputation: 1323115

That is why you should consider not using a VCS (Version Control System), like Git (which is a DVCS) or any other VCS for packaging and release management.

See Best practice to store .jar files in VCS (SVN, Git, …).

An external artifact repository like Nexus is more adapted, especially when it comes to clean up and remove the old packaged versions of your software.


I don't see how you can change anything in the Git history of your repo while preserving the link between said repo and your RedMine system: any change will trigger a new SHA1 reference.

Upvotes: 1

Related Questions