Can I use my own hosted gitblit to manage remote repositories

50 views
Skip to first unread message

Justin Jackson

unread,
Jun 16, 2015, 6:35:41 PM6/16/15
to git...@googlegroups.com
Hi all,

Very cool project you have here. 

I am trying to figure out how to use JGIT library in my own Jetty servlet service. The problem I am having is connecting to remote repos via ssh. I can run the code on the same server as a pure java app (you know main() method), and it works fine. My .ssh/id_rsa is already set up (as is known_hosts) to connect to the git repo server I am working with (it's an internal one, not GitHub or the likes). So the code works.. but as soon as I try to run the exact same code in a running servlet (via a JAX-RS API method), it fails with unknow host, or Invalid Remote: origin errors.

I noticed you use JGIT in your project. So my subject is.. if I deploy the gitblit app, can I use the API of gitblit to manage the connection of remote git repos programatically to clone the repos or get specific files from the remote repos to a local path? If so, are there any examples showing how to use the gitblit API in this manner? I can't seem to find very good documentation (or any) describing how to use the API..just a downloaded .jar file. 

To be clear, I am not looking to use gitblit to actually host git repos..but to use its library to pull remote git repos locally, either via clone, or otherwise. In fact, I only want a very specific set of files.. usually located in one directory within the remote repo. 

Thank you for any help.. been pulling my hair out for a few hours trying to figure out why this works outside the servlet container but not inside. Only assumption is maybe because the servlet container runs as a service, the user it runs under doesn't have .ssh/ set up right. I set up a jetty user, but don't have a /home/jetty user.. so that may be the reason why. Either way. if this gitblit works, I am fine hosting it and using it's API to do this rather than reinventing the wheel.

Eddy Young

unread,
Jun 16, 2015, 6:47:17 PM6/16/15
to git...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "gitblit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gitblit+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Jackson

unread,
Jun 16, 2015, 8:20:56 PM6/16/15
to git...@googlegroups.com
Thank you..that helped out. Turns out it was indeed my user.. when I switched the user to my local user everything worked. Using the Jetty user which has no shell access caused the headache! But I like that your JGitUtils class handles all of the GIT utils I would need and then some.


--
You received this message because you are subscribed to a topic in the Google Groups "gitblit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gitblit/fuzjN7GKD2w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gitblit+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages