Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirroring not updating #1059

Closed
lewellyn opened this issue Apr 16, 2016 · 7 comments · Fixed by #1381
Closed

Mirroring not updating #1059

lewellyn opened this issue Apr 16, 2016 · 7 comments · Fixed by #1381

Comments

@lewellyn
Copy link

I've set up a mirror per the instructions at http://gitblit.com/setup_mirrors.html

The source repository is hosted on GitHub Enterprise, and it was mirrored using HTTPS with a username and password. The Gitblit log shows: (sanitized to not give internal user, repo, or hostnames)

2016-04-15 00:02:50 [ERROR] Error updating mirror problematic-repository.git
org.eclipse.jgit.api.errors.TransportException: https://gituser@internal.github.enterprise/ORG/problematic-repository.git: Authentication is required but no CredentialsProvider has been registered
        at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
        at com.gitblit.service.MirrorService.run(MirrorService.java:149)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.eclipse.jgit.errors.TransportException: https://gituser@internal.github.enterprise/ORG/problematic-repository.git: Authentication is required but no CredentialsProvider has been registered
        at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:492)
        at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:296)
        at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
        at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
        at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
        at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
        ... 8 more

I notice that the logged URL does not include the password, but it is displayed in the Gitblit Web UI. I've been trying to follow exactly where and how the password may be lost (and hoping it's not a wild goose chase where it's simply not logged…), but I'm not succeeding so far. I'll update this ticket with code, if I manage to solve it on my own.

This is a showstopper bug for me, so I'll be investigating it heavily. However, if you have any suggestions for likely places to look (or know that it's fixed since 1.7.1), I'm all ears. 👂

@gitblit
Copy link
Collaborator

gitblit commented Apr 20, 2016

Hi @lewellyn. Try changing MirrorService line 149 to something like...

CredentialsProvider creds = null;
URIish fetchUri = new URIish(mirror.getURIs().get(0));
if (fetchUri.getUser() != null && fetchUri.getPass() != null) {
    creds = new UsernamePasswordCredentialsProvider(fetchUri.getUser(), fetchUri.getPass());
}
FetchResult result = git.fetch()
                    .setCredentialsProvider(creds)
                    .setRemote(mirror.getName())
                    .setDryRun(testing).call();

If that works, submit a PR and we'll mainstream it.

@rafi84
Copy link

rafi84 commented May 4, 2016

Thanks it worked with this:

    CredentialsProvider creds = null;
                URIish fetchUri = mirror.getURIs().get(0);
                if (fetchUri.getUser() != null && fetchUri.getPass() != null) {
                    creds = new UsernamePasswordCredentialsProvider(fetchUri.getUser(), fetchUri.getPass());
                }
                FetchResult result = git.fetch()
                                    .setCredentialsProvider(creds)
                                    .setRemote(mirror.getName())
                                    .setDryRun(testing).call();

@cmichaelis
Copy link

Just ran into this problem on 1.8.0 using Gitblit WAR. Did you ever send in a PR for this, and any chance it can get included in a future update to the WAR distribution? Thanks!

@paalgyula
Copy link

paalgyula commented Apr 20, 2018 via email

@cmichaelis
Copy link

If you wouldn't mind, that'd be great! Thank you very much!

@viennem
Copy link

viennem commented Jun 25, 2020

I'm running into the same problem in version 1.8.1 of the jar distribution with the credentials embedded in the origin url or using git config --global credential.helper store.
The documentation at http://gitblit.com/setup_mirrors.html says that it is possible to embed the credentials in the origin url.

Has this been fiixed in version 1.9.1?

@flaix
Copy link
Member

flaix commented Jul 3, 2020

I don't see a pull request for this ever being created. I also did not find one referencing mirroring, either open or closed. So I guess it hasn't been fixed, yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants