为什么我在日食 RCP 中使用 JGit 时会出现"需要密码"弹出窗口?



我正在使用Gitlab作为RCP应用程序中的存储库。gitlab4j用于导航组和项目,jgit用于克隆和获取。

我设置了访问Gitlab API的令牌,这很好。

当我克隆存储库(使用jgit(时,我会收到一个弹出窗口,希望我输入"的用户和密码;GitLab";。我只需按Cancel,克隆操作就会继续并成功完成。

我已经在eclipse之外尝试过相同的代码,目前没有问题。

我认为这与eclipse代理有关。如何以编程方式禁用代理或将其配置为忽略我的Gitlab URL?

Git git = Git
.cloneRepository()
.setCredentialsProvider(new UsernamePasswordCredentialsProvider("PRIVATE-TOKEN", token))
.setDirectory(dir)
.setURI("https://my-gitlab-repo")
.setNoCheckout(true)
.setProgressMonitor(pm)
.call();
git.checkout()
.setCreateBranch(true)
.setName(DEFAULT_BRANCH)
.setStartPoint("refs/tags/" + tag.getName())
.call()

更多信息

我曾尝试在plugin_customization.ini中设置core.net首选项以通过bass定义代理,但这没有帮助。

org.eclipse.core.net/nonProxiedHosts=git1.acme.com|localhost|127.0.0.1
org.eclipse.core.net/proxiesEnabled=true
org.eclipse.core.net/systemProxiesEnabled=false

我在URL中添加了登录凭据,并设置了CredentialsProvider,这阻止了登录弹出。

Git git = Git
.cloneRepository()
.setCredentialsProvider(new UsernamePasswordCredentialsProvider("PRIVATE-TOKEN", token))
.setDirectory(dir)
.setURI("https://gitlab-user:{the-token-here}@my-gitlab-repo")
.setNoCheckout(true)
.setProgressMonitor(pm)
.call();

相关内容

最新更新