简体   繁体   中英

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)?

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM