* Question: Is it possible to host a writable git repo over both http and ssh?
@ 2009-03-25 17:29 Mike Gaffney
2009-03-26 2:12 ` Jeff King
0 siblings, 1 reply; 9+ messages in thread
From: Mike Gaffney @ 2009-03-25 17:29 UTC (permalink / raw)
To: git
I am trying to setup a git repo internally at my work. I would like to
make the repo accessable via https for both read and write so that we
may access it from customer locations which don't allow anything but
https. I would also like to host it via SSH because that protocol is
much faster. I know that when you push with http it runs 'git
update-server-info', would I have to make the ssh pushes do the same?
Will this even work?
Thanks,
Mike Gaffney
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: Question: Is it possible to host a writable git repo over both http and ssh? 2009-03-25 17:29 Question: Is it possible to host a writable git repo over both http and ssh? Mike Gaffney @ 2009-03-26 2:12 ` Jeff King 2009-03-26 3:27 ` Mike Gaffney 0 siblings, 1 reply; 9+ messages in thread From: Jeff King @ 2009-03-26 2:12 UTC (permalink / raw) To: Mike Gaffney; +Cc: git On Wed, Mar 25, 2009 at 12:29:59PM -0500, Mike Gaffney wrote: > I am trying to setup a git repo internally at my work. I would like to > make the repo accessable via https for both read and write so that we may > access it from customer locations which don't allow anything but https. I > would also like to host it via SSH because that protocol is much faster. I > know that when you push with http it runs 'git update-server-info', would > I have to make the ssh pushes do the same? Will this even work? Yes, it should work just fine. All pushes, no matter how they arrive at the repository, will need to run "git update-server-info", which is what allows "dumb" protocols like http to read from the repository. The default post-update hook does this; you just need to enable it by "cd .git/hooks && mv post-update.sample post-update". -Peff ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question: Is it possible to host a writable git repo over both http and ssh? 2009-03-26 2:12 ` Jeff King @ 2009-03-26 3:27 ` Mike Gaffney 2009-03-26 3:36 ` Jeff King 0 siblings, 1 reply; 9+ messages in thread From: Mike Gaffney @ 2009-03-26 3:27 UTC (permalink / raw) To: Jeff King; +Cc: git Does this go for JGit as well? -Mike Jeff King wrote: > On Wed, Mar 25, 2009 at 12:29:59PM -0500, Mike Gaffney wrote: > >> I am trying to setup a git repo internally at my work. I would like to >> make the repo accessable via https for both read and write so that we may >> access it from customer locations which don't allow anything but https. I >> would also like to host it via SSH because that protocol is much faster. I >> know that when you push with http it runs 'git update-server-info', would >> I have to make the ssh pushes do the same? Will this even work? > > Yes, it should work just fine. All pushes, no matter how they arrive at > the repository, will need to run "git update-server-info", which is what > allows "dumb" protocols like http to read from the repository. The > default post-update hook does this; you just need to enable it by "cd > .git/hooks && mv post-update.sample post-update". > > -Peff -- -Mike Gaffney (http://rdocul.us) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question: Is it possible to host a writable git repo over both http and ssh? 2009-03-26 3:27 ` Mike Gaffney @ 2009-03-26 3:36 ` Jeff King 2009-03-26 4:55 ` Mike Gaffney 0 siblings, 1 reply; 9+ messages in thread From: Jeff King @ 2009-03-26 3:36 UTC (permalink / raw) To: Mike Gaffney; +Cc: git On Wed, Mar 25, 2009 at 10:27:03PM -0500, Mike Gaffney wrote: > Does this go for JGit as well? The hook must be enabled on the server side; are you running JGit on the server, or regular git? -Peff ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question: Is it possible to host a writable git repo over both http and ssh? 2009-03-26 3:36 ` Jeff King @ 2009-03-26 4:55 ` Mike Gaffney 2009-03-26 4:56 ` Jeff King 0 siblings, 1 reply; 9+ messages in thread From: Mike Gaffney @ 2009-03-26 4:55 UTC (permalink / raw) To: Jeff King; +Cc: git I'm actually trying to take what Sean did with gerrit and extract a full Java/MinaSSHD based server that doesn't require a real user account and is configurable by spring. So yes, I'm using JGit on the server. -Mike Jeff King wrote: > On Wed, Mar 25, 2009 at 10:27:03PM -0500, Mike Gaffney wrote: > >> Does this go for JGit as well? > > The hook must be enabled on the server side; are you running JGit on the > server, or regular git? > > -Peff -- -Mike Gaffney (http://rdocul.us) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question: Is it possible to host a writable git repo over both http and ssh? 2009-03-26 4:55 ` Mike Gaffney @ 2009-03-26 4:56 ` Jeff King 2009-03-26 5:18 ` Robin Rosenberg 0 siblings, 1 reply; 9+ messages in thread From: Jeff King @ 2009-03-26 4:56 UTC (permalink / raw) To: Mike Gaffney; +Cc: Shawn O. Pearce, git On Wed, Mar 25, 2009 at 11:55:29PM -0500, Mike Gaffney wrote: > I'm actually trying to take what Sean did with gerrit and extract a > full Java/MinaSSHD based server that doesn't require a real user > account and is configurable by spring. So yes, I'm using JGit on the > server. Ah. In that case, I don't know whether JGit respects all hooks. You should ask Shawn (Shawn, we are talking about a post-update to run update-server-info). :) -Peff ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question: Is it possible to host a writable git repo over both http and ssh? 2009-03-26 4:56 ` Jeff King @ 2009-03-26 5:18 ` Robin Rosenberg 2009-03-26 9:46 ` Rogan Dawes 0 siblings, 1 reply; 9+ messages in thread From: Robin Rosenberg @ 2009-03-26 5:18 UTC (permalink / raw) To: Jeff King; +Cc: Mike Gaffney, Shawn O. Pearce, git torsdag 26 mars 2009 05:56:51 skrev Jeff King <peff@peff.net>: > On Wed, Mar 25, 2009 at 11:55:29PM -0500, Mike Gaffney wrote: > > > I'm actually trying to take what Sean did with gerrit and extract a > > full Java/MinaSSHD based server that doesn't require a real user > > account and is configurable by spring. So yes, I'm using JGit on the > > server. > > Ah. In that case, I don't know whether JGit respects all hooks. You > should ask Shawn (Shawn, we are talking about a post-update to run > update-server-info). :) Arguably it should. but it doesn't. Then there is a question as to what format those hooks should be. Shell scripts would run into platform issues and jgit based stuff should have as little as possible of that, but a similar mechanism should exist. -- robin ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question: Is it possible to host a writable git repo over both http and ssh? 2009-03-26 5:18 ` Robin Rosenberg @ 2009-03-26 9:46 ` Rogan Dawes 2009-03-26 16:57 ` Shawn O. Pearce 0 siblings, 1 reply; 9+ messages in thread From: Rogan Dawes @ 2009-03-26 9:46 UTC (permalink / raw) To: Robin Rosenberg; +Cc: Jeff King, Mike Gaffney, Shawn O. Pearce, git Robin Rosenberg wrote: > torsdag 26 mars 2009 05:56:51 skrev Jeff King <peff@peff.net>: >> On Wed, Mar 25, 2009 at 11:55:29PM -0500, Mike Gaffney wrote: >> >>> I'm actually trying to take what Sean did with gerrit and extract a >>> full Java/MinaSSHD based server that doesn't require a real user >>> account and is configurable by spring. So yes, I'm using JGit on the >>> server. >> Ah. In that case, I don't know whether JGit respects all hooks. You >> should ask Shawn (Shawn, we are talking about a post-update to run >> update-server-info). :) > > Arguably it should. but it doesn't. Then there is a question as to what > format those hooks should be. Shell scripts would run into platform > issues and jgit based stuff should have as little as possible of that, but > a similar mechanism should exist. > > -- robin > Maybe support executing scripts via Bean Scripting Framework? That would allow scripts to be written in any of the supported languages, as long as the appropriate interpreter is present. e.g. BeanShell, Groovy, Jython, etc See http://jakarta.apache.org/bsf/ If you define an interface for each hook, the scripts could implement the interface, and execute that way. Here is an example, mishmashed from <http://www.beanshell.org/examples/actionhandler.html> and <http://jvm-languages.com/wiki/Bean_Scripting_Framework#Interacting_with_Complex_Objects>: ======8x===== Java code ========= public class BSFFileUtils { public Object evalFile (BSFManager manager, File file) throws IOException { String fileName = file.getPath(); String language = manager.getLangFromFilename(fileName); String code = extractFileContents(file); return manager.eval(language, fileName, 0, 0, code); } private String extractFileContents (File file) throws IOException { StringBuffer buf = new StringBuffer(); BufferedReader r = new BufferedReader(new FileReader(file)); try { int len; char[] chars = new char[8192]; while ((len = r.read(chars, 0, chars.length)) != -1) { buf.append(chars, 0, len); } return buf.toString(); } finally { r.close(); } } } public static void main (String[] args) { String directory = args[0]; File file = new File("actionHandler.bsh"); BSFManager manager = new BSFManager(); ActionListener listener = (ActionListener) BSFFileUtils.evalFile(manager, file); JButton button = new JButton("MyButton"); button.addActionListener(listener); JFrame f = new JFrame(); f.getContentPane().add( button ); f.show(); } ======8x===== BeanShell code ========= actionHandler.bsh import java.awt.event.ActionListener; actionPerformed( e ) { print("Button Pressed: " + e); } return (ActionListener)this; ======8x============================== Having said all this, it is probably worth implementing update-server-info in Java, so as to avoid having to shell out to perform this action, and keep it all platform-independent. Rogan ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Question: Is it possible to host a writable git repo over both http and ssh? 2009-03-26 9:46 ` Rogan Dawes @ 2009-03-26 16:57 ` Shawn O. Pearce 0 siblings, 0 replies; 9+ messages in thread From: Shawn O. Pearce @ 2009-03-26 16:57 UTC (permalink / raw) To: Rogan Dawes, Mike Gaffney; +Cc: Robin Rosenberg, Jeff King, git Rogan Dawes <lists@dawes.za.net> wrote: > Robin Rosenberg wrote: > > torsdag 26 mars 2009 05:56:51 skrev Jeff King <peff@peff.net>: > >> On Wed, Mar 25, 2009 at 11:55:29PM -0500, Mike Gaffney wrote: > >> > >>> I'm actually trying to take what Sean did with gerrit and extract a > >>> full Java/MinaSSHD based server that doesn't require a real user > >>> account and is configurable by spring. So yes, I'm using JGit on the > >>> server. > >> Ah. In that case, I don't know whether JGit respects all hooks. You > >> should ask Shawn (Shawn, we are talking about a post-update to run > >> update-server-info). :) JGit already has the native code needed for update-server-info. Look at WalkPushConnection: line 185-187 calls refWriter.writeInfoRefs() to update the GIT_DIR/info/refs for dumb transports. We just need to call that in the end of the receive code. line 236 calls WalkRemoteObjectDatabase.writeInfoPacks() to update the GIT_DIR/objects/info/packs file. This needs to be abstracted out so we can more easily reuse it. > > Arguably it should. but it doesn't. Then there is a question as to what > > format those hooks should be. Shell scripts would run into platform > > issues and jgit based stuff should have as little as possible of that, but > > a similar mechanism should exist. Yup, I agree. At the very least we should suppot doing the update-server-info logic from pure Java, as it is probably the most common operation people would want in a post receive hook. > Maybe support executing scripts via Bean Scripting Framework? > > That would allow scripts to be written in any of the supported > languages, as long as the appropriate interpreter is present. > > e.g. BeanShell, Groovy, Jython, etc > > See http://jakarta.apache.org/bsf/ > > If you define an interface for each hook, the scripts could implement > the interface, and execute that way. Yes, that is one option. I'd like to get a reasonable binding to BSF for JGit, but its more of a wish than a real need for me, so I just don't bother. I think many people who want to script Git from Python would be reasonably happy with executing that script through Jython if there was a decent binding. -- Shawn. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-03-26 16:59 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-03-25 17:29 Question: Is it possible to host a writable git repo over both http and ssh? Mike Gaffney 2009-03-26 2:12 ` Jeff King 2009-03-26 3:27 ` Mike Gaffney 2009-03-26 3:36 ` Jeff King 2009-03-26 4:55 ` Mike Gaffney 2009-03-26 4:56 ` Jeff King 2009-03-26 5:18 ` Robin Rosenberg 2009-03-26 9:46 ` Rogan Dawes 2009-03-26 16:57 ` Shawn O. Pearce
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).