我们正在使用git来维护我们的源代码。像git@xx.xx:XYZ.git这样的网址。我正在使用JGit来提取更改。
UsernamePasswordCredentialsProvider user = new UsernamePasswordCredentialsProvider("xxxx", "xxxx");
localPath = "E:\\murugan\\Test\\GIT_LOCALDEPY";
Git git = new Git(localRepo);
PullCommand pcmd = git.pull();
pcmd.setCredentialsProvider(user);
pcmd.call();当我执行代码时,我得到了下面的异常。
org.eclipse.jgit.errors.UnsupportedCredentialItem: ssh://git@xx.xx.xx.xx:22:
org.eclipse.jgit.transport.CredentialItem$StringType:Passphrase for C:\Users\Murugan.SOLVER\.ssh\id_rsa发布于 2015-07-23 18:26:42
如果用户名/密码安全性不是问题,您可以在本地Git存储库的.git/config文件中将凭据指定为连接的一部分:
[remote "origin"]
url = ssh://<user>:<pwd>@<host>:22/<remote-path-to-repo>/
fetch = +refs/heads/*:refs/remotes/origin/*发布于 2012-08-10 17:22:55
在使用Git之前,您必须在您的计算机上配置SSH参数。这里有一个来自github的链接,用于配置它。
https://help.github.com/categories/56/articles
特别是这个:https://help.github.com/articles/generating-ssh-keys
这将帮助您正确设置所有内容(您应该调整所有内容,因为您可能没有连接到GitHub)
https://stackoverflow.com/questions/11897404
复制相似问题