Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] jgit problems with Github and Amazon S3

On Mon, Mar 14, 2011 at 01:53, Bryan Murphy <jgit@xxxxxxxxxxxxxxx> wrote:
> Sorry if this is not the right place to communicate but I couldn't find an
> obviously better alternative.

Nope, this is the correct place. :-)

> Firstly I would suggest a few more examples in the user guide. jgit does not
> seem to always default unspecified values in the same way git does so it
> took me a bit of trial and error to figure out which setters to call eg git
> push has default of "master" but jgit requires a call to setRefSpecs() to
> specify "master" ie git.push().setRefSpecs(new RefSpec("master")).call()

This is a good point. I think C Git might default to the current
branch, not "master". But JGit probably should do something similar in
its PushCommand class. I have pushed as
a proposed change to make the current branch the default if a branch
has not been specified.

> Secondly, when jgit is used in a standalone manner (ie outside egit) there
> is no CredentialsProvider in the distributed jgit jar that supports a
> connection to GitHub that uses an encrypted ssh private key (which I think
> is the standard way of working with Github).   The git source code
> repositories for jgit include a few more packages (eg
> org.eclipse.jgit.console and org.eclipse.jgit.ui) that are not in the
> distributed jars and these provided the example I needed (ie
> ConsoleCredentialsProvider) to get a push working to github.  Once I
> provided my own CredentialsProvider that provided a get() method that
> supported CredentialItem.StringType and returned the passphrase that was
> encrypting the private key then I was able to get a push to github working:
> ie git.push().setRemote("githubrepo").setRefSpecs(new
> RefSpec("master")).setCredentialsProvider(new
> MyCredentialsProvider()).call().   So I would suggest a
> EncryptedPrivateKeySshCredentialsProvider with an abstract getPassphrase()
> be put into org.eclipse.jgit.transport along with a small example in the
> users guide.

This is a little harder than it sounds. Contributions are welcome if
you would like to add this class to JGit. :-)

> Thirdly I found what I think is a bug introduced in jgit 0.11.x that causes
> the initial push to an Amazon S3 "repository" to be incomplete (ie only the
> refs and info directories are created).  jgit 0.10.1 works properly but jgit
> 0.11.3 does not.  My investigation narrowed this down to
> PackWriter.getObjectsNumber().  In 0.11.3 it has been changed to use
> stats.totalObjects but when PackWriter.getObjectsNumber() is called in
> WalkPushConnection.sendpack() the stats.totalObjects value hasn't been set
> yet (it only seems to get set in PackWriter.writePack())

You are correct, thanks. I have pushed
as a fix for this issue.


Back to the top