jgit

Eclipse Luna git checkout ssl fails

笑着哭i 提交于 2019-12-12 05:27:34
问题 when I try to checkout from git in eclipse Luna it says git@-myrepo:myproj-.git: ProxyHTTP: java.io.IOException: proxy error: Proxy Error ( The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is not configured to allow SSL requests from this port. Most Web browsers use port 443 for SSL requests. ) git@-myrepo:myproj-.git: ProxyHTTP: java.io.IOException: proxy error: Proxy Error ( The specified Secure Sockets Layer (SSL) port is not allowed. Forefront TMG is not

Equivalent of git diff in JGit

孤人 提交于 2019-12-12 02:57:33
问题 How can I get the result for git diff a.txt b.txt , for files, a.txt and b.txt, that are not part of a repository? I want the output in the format git diff provides. Also, I can't run git commands through Java due to some restrictions. 回答1: The JGit diff code is located in DiffFormatter and its associated classes. If you take a closer look, you'll see that the code isn't meant to diff arbitrary byte streams. It is coupled to a an existing repository with commits, trees, etc. If you don't mind

Viewing file from Git using JGIT remotely without creating local repo

一个人想着一个人 提交于 2019-12-11 17:35:07
问题 I m writing a web application where it accepts the git URL and file to read and then displays the file on the webpage. I m using JGit for this. I see that JGit needs a local repository to clone before viewing the file. Since this is server, I do not have access to local files. So, is there anyway I can access the git remotely and view the file from there? Thanks 回答1: It's not just JGit that needs a local repository, Git itself requires a local repository. Centralized version control systems

jgit addFilePattern not working for my absolute path to a file

六眼飞鱼酱① 提交于 2019-12-11 15:17:01
问题 jgit version 4.6.0 , java 1.8 , windows 10 I have written a java program to push to a git repository where as I want to push specific files at a time instead of pushing all files. git.add.addFilePattern(".").call(); works fine. but git.add.addFilePattern("D:\\myGitRepo\\files\\file1.txt").call(); is not working. "myGitRepo" folder contains the .git folder. 回答1: Summary The Javadoc of method AddCommand#addFilepattern(String) says that: parameter filepattern is repository-relative path of file

Git status does not show changes when creating repo in JGit

爱⌒轻易说出口 提交于 2019-12-11 14:49:11
问题 I was trying JGit, for project like sample-- |-- src |---sampletest |------Test.txt I make this git project by repo.create() in JGit, and I can find .git inside sample. But whenever I modified the Test.txt. It was not displayed in git status from terminal. I am unable to figure out the answer. Also is there any other Java API that can be used? EDIT This project does not have .git intially. I did, repository = new FileRepository(<somepath>/sample/+".git"); git = new Git(repository); This

How to get conflicting lines with JGit

雨燕双飞 提交于 2019-12-11 06:28:06
问题 I'm developing the application, in which JGit is used. After a pull, I have conflicting files. I can get it from List<String> list = git.status().call().getConflicting(); The list contains files in conflict. I know, that I can get conflicting files from Map<String, int[][]> conflicts = git.pull().call().getMergeResult().getConflicts(); but it doesn't work if I restart my application. After the restart, I will have an empty map because I'm not able to redo the pull when the repository is in

Is it possible to commit a file to a remote base repository using JGit

只谈情不闲聊 提交于 2019-12-11 05:47:35
问题 My requirement is that I want to programmatically commit a file to a remote base repository (that resides in a central location like https//:myproject.git ). I would like to know if it is possible to commit a file to a remote base repository (master) without cloning the base repo into my local machine. I am a newbie to JGit. Please let me know. 回答1: As @larsks already pointed out, you need to first create a local clone of the remote base repository. Changes can only be committed to the local

JGit/EGit crashing on branch deletion/creation

半城伤御伤魂 提交于 2019-12-11 03:41:49
问题 I am trying to delete a branch from Git repositories view in eclipse Juno, running on Mac OS X lion, 64 bit. I get the following error log while I try to do so, and the changes are not reflected in the remote repository. org.eclipse.jgit.errors.RevisionSyntaxException:refs/remotes/origin/IMAdNetwork_3.5.4@8578 at org.eclipse.jgit.lib.Repository.resolve(Repository.java:649) at org.eclipse.jgit.lib.Repository.resolve(Repository.java:383) at org.eclipse.egit.ui.internal.repository

Cloning remote repository fails using JGit for http url

不打扰是莪最后的温柔 提交于 2019-12-11 01:37:10
问题 The problem here is, URL is redirected which is not handled in JGit. There are no of bugs reported for same and it is also mentioned that they are resolved but I am still facing this issue. Please let me know if I am doing anything wrong. Code Snippet private static Git cloneRepository(String url, String branch, String targetPath) throws IOException { Git result = null; try { CloneCommand cloneCommand = Git.cloneRepository().setCloneSubmodules(true) .setURI(url).setBranch(branch)

Determine Tracking Branch in JGit

 ̄綄美尐妖づ 提交于 2019-12-10 21:21:58
问题 I would like to determine the remote tracking branch of HEAD using JGit. In straight git, I can do: git rev-parse --abbrev-ref --symbolic-full-name @{upstream} How can I do this in JGit? 回答1: new BranchConfig(repo.getConfig(), repo.getBranch()).getTrackingBranch() 来源: https://stackoverflow.com/questions/29044207/determine-tracking-branch-in-jgit