Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] [egit-dev] Getting permission when using the push command

2011/1/11 Shawn Pearce <spearce@xxxxxxxxxxx>
On Tue, Jan 11, 2011 at 00:30, Jan Finis <finis@xxxxxxxxx> wrote:
> this question is related to using JGit. But I guess this is the same mailing
> list?

Actually its jgit-dev@xxxxxxxxxxx.

> I tried using the Git class with its push command to make a push in java
> code. However, I cannot state a password, so I get a TransportException
> telling me that I am not authorized.
>
> So how can I set username and password for a git push command that was
> created with the Git class? Username can be encoded into the remote string,
> but not the password...

Right now you can't.  The PushCommand class is missing a way to obtain
and pass through a CredentialsProvider to the underlying Transport
instances that it will open.  You would need to use the Transport
class directly.

You may have a look how egit does this here [1]

[1] http://egit.eclipse.org/w/?p=egit.git;a=blob;f=org.eclipse.egit.core/src/org/eclipse/egit/core/op/PushOperation.java;h=6cedef9753301018d1510849289adff4c9d200e2;hb=HEAD 

--
Matthias

Back to the top