我想克隆远程存储库,添加文件并将文件推回,但得到异常:
org.eclipse.jgit.api.errors.TransportException: git://192.168.1.1/abc: Connection refused: connect
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:137)
at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:178)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:125)守则是:
UsernamePasswordCredentialsProvider user = new UsernamePasswordCredentialsProvider(userId, userPass);
File workingCopy = new File(REPO_PATH);
Git.cloneRepository().setCredentialsProvider(user).setURI(uri).setDirectory(workingCopy).setBranch("master").setBare(false).setRemote("origin").setNoCheckout(false).call();现在远程回购在本地主机上,当我在path中使用" localhost“时,一切正常,当使用IP地址时,我得到了上面的异常。端口9418已解锁。
有什么想法吗?提前谢谢。
发布于 2014-02-12 12:53:02
如果您收到“拒绝连接”错误消息,这(通常)意味着没有任何服务正在侦听您的客户端试图连接的IP地址+端口。
确认此问题的一个常见技巧是使用其他实用程序尝试连接到问题IP +端口。telnet实用程序通常用于此操作。安装它(如果必要的话),并检查手动条目,以找到指定端口号的命令行选项。(这将取决于您的操作系统.)
如果您说本地主机正常工作,并且您正在使用的端口不会被本地防火墙阻塞,最有可能的解释是您只配置了Git服务器软件来侦听localhost IP地址(通常是127.0.0.1)。
发布于 2014-02-18 20:16:42
为git协议设置凭据提供程序是没有意义的,因为它是匿名的
https://stackoverflow.com/questions/21727975
复制相似问题