Need JGit help [message #1853981] |
Tue, 26 July 2022 19:10  |
Joseph Gagnon Messages: 4 Registered: July 2022 |
Junior Member |
|
|
I am writing an application for the purposes of creating (and restoring from) archives of GitLab projects. Archived repos would be stored as zipped tar files and stored on an external removable drive. Many of the projects use LFS and we need to be able to successfully archive and restore these large files as well.
I am attempting to use JGit to perform various git-related operations on the repos to be archived and restored. I'm not having much luck finding information on how to make use of the JGit ecosystem to do some of these operations. The user guide is very bare bones. I have found another site (https://github.com/centic9/jgit-cookbook), that has provided useful information, but does not cover some of the other operations I need to perform.
I think the main problem I'm having at this time is that I'm having trouble understanding how to get access to a remote git repo. Maybe I'm missing it, but I can't find anything that seems to allow this in the Repository, RepositoryBuilder or Git classes. There doesn't seem to be any support for a remote URL/URI, except for Git.cloneRepository.
Here are a number of the operations that I need to perform:
For archival:
lfs fetch --all
For restoration:
git config credential.helper 'cache --timeout=36000'
git config lfs.activitytimeout 36000
git remote rename origin old-origin
git remote add origin
git push -u origin --all
git push -u origin --tags
git lfs push --all origin
To be honest, I'm not 100% sure if the process that includes these operations is "correct" to achieve the goal mentioned above. I am basing this on a process written by someone else. I don't know if it actually works.
I need to know how to be able to execute these operations, but don't know enough about how to do it with JGit. If anyone could provide ideas of what to do, or point me to examples where this is being done, it would be very much appreciated.
Somewhat off topic, if there is a better way to do this, please let me know. My application uses other libraries to handle invoking the GitLab REST API and deal with tar file operations, etc.
[Updated on: Tue, 26 July 2022 21:12] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.01880 seconds