Questions tagged [jgit]

JGit is an EDL (new-style BSD) licensed, lightweight, pure Java library implementing the Git version control system.

JGit is an EDL (new-style BSD) licensed, lightweight, pure Java library implementing the version control system.

It is developed as part of the Eclipse Git Plugin .

JGit Supports:

  • Repository access routines
  • Network protocols
  • Core version control algorithms
  • Implementation of many porcelain commands
  • tasks for performing Git operations as part of automated builds
  • A Git daemon to provide a simple Git server
  • A jgit commandline tool for working with Git repositories

For details visit the Project page or the User Guide, there is also API Documentation available.

The community-provided jgit-cookbook provides ready-to-run snippets that show how things can be achieved when using JGit

956 questions
7
votes
1 answer

JGit get pulled files

I have one repository in two different folders ( folder1 and folder2). Within repositories has a "oldFile" file In the folder1 I do the following steps: echo 123 > oldFile touch newFile git add newFile oldFile git commit -m "Change the oldFile from…
Andrew Bystrov
  • 181
  • 1
  • 14
7
votes
0 answers

How to use JGit https authentication using Kerberos

I am trying to clone a git repository over https from a windows server. This server uses single-sign-on and therefore relates to kerberos5. Having little knowledge with that my simple code: CloneCommand clone =…
Christian
  • 446
  • 2
  • 14
7
votes
3 answers

Using SSH authentication with JGit to Access a Git Repository Securely / Auth fail

I'm using JGit in scala to access a remote Git repo, and I need to use SSH for authentication. JGit uses JSch to provide secure access. I followed this tutorial : http://www.codeaffine.com/2014/12/09/jgit-authentication/ However, i have always, an …
Houssem Ben Slama
  • 111
  • 1
  • 1
  • 4
7
votes
2 answers

.pack file from git repo can't be deleted using File delete() method

For this method I am writing, I am cloning a git repo using the jgit library, then doing some stuff with those files, then finally I want to delete the repo. The problem I'm having is that when I call the delete() method on a .pack file (located in…
slyslayer223
  • 175
  • 2
  • 6
7
votes
2 answers

JGit detect rename in working copy

Contex I'm trying to detect possible file rename that occurred after last commit, in a working copy. On my example, I have a clean working copy and I do that: git mv old.txt new.txt Running $ git status shows the expected result: # Changes to be…
Serge Farny
  • 932
  • 10
  • 22
7
votes
1 answer

Configuring known_hosts in jgit

Using jgit with gitolite for source control, I have an application that generates certain code on command and which we want to be committed to source control. The goal is to pull with a fast forward, commit the new code, and then push it. I have…
StormeHawke
  • 5,987
  • 5
  • 45
  • 73
7
votes
1 answer

Get all tags of a repository with JGit

I want to get a list of all tags of a repository together with the tagger and the commit-IDs with JGit. First I tried the Git.tagList().call() command and parse the tags: objectIdOfTag = oneResultOfTheTagList.getObjectId(); // or should I call…
Sonson123
  • 10,879
  • 12
  • 54
  • 72
6
votes
1 answer

How to set tracking on an existing repo to a remote repo with ngit (or jgit)?

I am working on a gui based helper utility that will: Init a local repo, Init (bare) a remote repo Add .gitignore based on a project type Commit all the files locally Add a remote repo to the local config Push master to the remote repo Create a…
Carl Stewart
  • 335
  • 2
  • 11
6
votes
2 answers

How to set the commit time with JGit?

Is there a way to set the commit time with JGit? I flipped through the API and found that it can only be done by modifying the local system time. I want to implement it through code. And can run normally on the win system.
xiao luo
  • 777
  • 1
  • 5
  • 6
6
votes
2 answers

Working with a remote repository in JGit

I am working on a project where we have to use JGit. I have a problem when I try to work with a remote git repository (the git that is not cloned in my local device) I receive the following exception: No HEAD exists and no explicit starting…
JurajRabcan
  • 133
  • 1
  • 11
6
votes
0 answers

Wrong result when using JGit blame

When I run the following sample code: public static void main(String[] args) throws IOException, GitAPIException { Git git = new Git(new FileRepository(PATH_TO_REPO); BlameCommand blameCommand = git.blame(); …
Moaz
  • 63
  • 1
  • 5
6
votes
1 answer

jgitflow:release-finish is not deleting the release branch

I recently finished merging a release branch to master and develop using jgitflow:release-finish. The build was successful. But now I am trying to create a new branch using jgitflow:releast-start. But it is giving the below error. [ERROR] Failed to…
6
votes
1 answer

How to get conflicts before merge with JGit?

I am trying to perform with JGit all the merge scenarios from a project that had conflicts. Is it possible to get the conflicts prior to the actual merge? In other words, is it possible to simulate a merge with JGit? My goal is to access the…
6
votes
1 answer

Make an existing Git branch track a remote branch with JGit?

I am using JGit for creating a new git repository, and everything already present in the folder, I save as new branch. I am using Git.init().setDirectory(workingDir).call(); (by-default master branch is created after above statement, so i rename…
Amir Ashfaq
  • 335
  • 4
  • 11
6
votes
2 answers

How to call git show --first-parent in jgit?

I need to get the commits from master that are not of type merge and do not come from other branches (they were directly put on master). The git command is git log --no-merges --first-parent How can I do this using JGit? I managed to get…
israell
  • 173
  • 2
  • 9