Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336301 - Push from JGit->JGit "push not permitted"
Summary: Push from JGit->JGit "push not permitted"
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-03 20:42 EST by Roland Schulz CLA
Modified: 2011-02-06 17:06 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Schulz CLA 2011-02-03 20:42:18 EST
I can successfully use JGit to push to GIT, GIT to JGit and GIT to GIT. Thus the following three commands work:

sh org.eclipse.jgit.pgm-0.10.1.sh push --receive-pack=/path/to/git-receive-pack host:path ref
git push --receive-pack= "sh org.eclipse.jgit.pgm-0.10.1.sh receive-pack" host:path ref
git push --receive-pack=/path/to/git-receive-pack host:path ref

But if I try to push from JGit to JGit using
sh org.eclipse.jgit.pgm-0.10.1.sh push --receive-pack "sh org.eclipse.jgit.pgm-0.10.1.sh receive-pack" host:path ref

I get:
org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of push command
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:148)
at org.eclipse.jgit.pgm.Push.run(Push.java:123)
at org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:13 9)
at org.eclipse.jgit.pgm.Main.execute(Main.java:191)
at org.eclipse.jgit.pgm.Main.run(Main.java:120)
at org.eclipse.jgit.pgm.Main.main(Main.java:94)
Caused by: org.eclipse.jgit.errors.TransportException: carver:download/gromacs.threading: push not permitted
at org.eclipse.jgit.transport.BasePackPushConnection.noReposito ry(BasePackPushConnection.java:149)
at org.eclipse.jgit.transport.BasePackConnection.readAdvertised RefsImpl(BasePackConnection.java:198)
at org.eclipse.jgit.transport.BasePackConnection.readAdvertised Refs(BasePackConnection.java:176)
at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection . <init>(TransportGitSsh.java:468)
at org.eclipse.jgit.transport.TransportGitSsh.openPush(Transpor tGitSsh.java:109)
at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.j ava:130)
at org.eclipse.jgit.transport.Transport.push(Transport.java:962 )
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:144)
... 5 more

I seems that jgit receive pack doesn't send the possible refs. It from when pushing from GIT because it doesn't require this. But jgit requires to receive a list of possible refs.

Reproducible: always
Version: both 0.10.1 and latest HEAD version from today.
Comment 1 Shawn Pearce CLA 2011-02-04 08:52:47 EST
(In reply to comment #0)
> But if I try to push from JGit to JGit using
> sh org.eclipse.jgit.pgm-0.10.1.sh push --receive-pack "sh
> org.eclipse.jgit.pgm-0.10.1.sh receive-pack" host:path ref

The problem is JGit's LocalTransport spawn() method doesn't split the getReceivePack() option string.  It is passing the entire string as-is as the program to execute.  And of course you do not have a program called "sh<space>org.eclipse.jgit.pgm-0.10.1.sh" in your $PATH, so this fails.

CGit must be passing this string through the local shell with sh -c, so we need to fix JGit to do the same.

I've uploaded http://egit.eclipse.org/r/2416 as a possible fix.
Comment 2 Roland Schulz CLA 2011-02-04 14:59:53 EST
(In reply to comment #1)
> (In reply to comment #0)
> > But if I try to push from JGit to JGit using
> > sh org.eclipse.jgit.pgm-0.10.1.sh push --receive-pack "sh
> > org.eclipse.jgit.pgm-0.10.1.sh receive-pack" host:path ref
> 
> The problem is JGit's LocalTransport spawn() method doesn't split the
> getReceivePack() option string.  It is passing the entire string as-is as the
> program to execute.  And of course you do not have a program called
> "sh<space>org.eclipse.jgit.pgm-0.10.1.sh" in your $PATH, so this fails.
> 
> CGit must be passing this string through the local shell with sh -c, so we need
> to fix JGit to do the same.
> 
> I've uploaded http://egit.eclipse.org/r/2416 as a possible fix.

This fixes it for local push. It still doesn't work for push over SSH.
Comment 3 Chris Aniszczyk CLA 2011-02-06 10:38:03 EST
Fixed in stable-0.11, will be part of the release when we ship next week.
Comment 4 Roland Schulz CLA 2011-02-06 14:01:19 EST
(In reply to comment #3)
> Fixed in stable-0.11, will be part of the release when we ship next week.

As already wrote in comment #2: this only fixes it for the local transport. 

Thus 
jgit.sh push --receive-pack "jgit.sh receive-pack" $HOME/g2 master 
is fixed in stable-0.11.
But
jgit.sh push --receive-pack "jgit.sh receive-pack" localhost:g2 master 
still doesn't work.
Comment 5 Shawn Pearce CLA 2011-02-06 17:06:25 EST
Change http://egit.eclipse.org/r/2435 resolves this for SSH.