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
4
votes
1 answer

Find out the SHA1 of a file from the index

Short story: Like the title says, how to get the SHA1 or hash from the index of a checked out file using JGit? Long story: I am writing an GUI application and using JGit for revisioning of just one file. So a user is able to open a window which…
Hrvoje Varga
  • 238
  • 1
  • 2
  • 8
3
votes
4 answers

Should "git gc" be run periodically on gerrit managed git repositories?

Will running cgit periodically cause any harm (since gerrit manipulates the repo with JGit)? Does JGit perform this function automatically?
jnorris
  • 6,350
  • 8
  • 30
  • 33
3
votes
1 answer

How do I do the equivalent of “git remote update” with jgit?

I'm managing git repos cloned with --mirror, and I need to do a git remote update using JGit. Do I use a FetchCommand, or is there any other command? What is the equivalent FetchCommand of a git remote update?
tuler
  • 3,339
  • 7
  • 34
  • 44
3
votes
1 answer

How to replace an eclipse project with latest version from head using EGit?

I have an eclipse workspace with a bunch of projects from git, I am using egit to manage the project. I typically try out experiments which fail, and I want to take a project and restore it to exactly its state in HEAD of the git repo. How do I do…
ams
  • 60,316
  • 68
  • 200
  • 288
3
votes
4 answers

Committing and Pushing to GitHub using JGit - Bare Repo?

Today I signed up for github, and converted an existing filesystem into a git repo using the technique described here: http://crashingdaily.wordpress.com/2009/09/02/initing-a-new-remote-git-repository-with-existing-files/ Most importantly (I think)…
mtrc
  • 1,317
  • 3
  • 16
  • 39
3
votes
1 answer

Find all commits that changed a given directory from Java

I write a Java program, and I use jgit. In this Java program, I want to list all commits of some git repository g that changed at least one file in a directory x. I do not want to solve the problem "on command line", but within Java.
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
3
votes
1 answer

Call a child class method from a parent class object with Factory Pattern

I have a service that uses repositories from multiple Git version control platforms as Gitlab, GitHub.. etc I am using Jgit library in Java so I created a GitService which have the basic git commands public class GITService { public void…
Makook
  • 41
  • 5
3
votes
3 answers

Error occured cloning to base directory git@bitbucket.org:myapp/configurations.git failed to send channel request

I am getting the following error when I try to connect spring cloud config to a bitbucket repo. .c.s.e.MultipleJGitEnvironmentRepository : Error occured cloning to base directory. org.eclipse.jgit.api.errors.TransportException:…
Tony
  • 363
  • 3
  • 17
3
votes
1 answer

Not able to clone Github repo using jgit api getting invalid Remote Exception

Not able to clone Github repo using jgit api getting invalid Remote Exception. I am getting this error when i am running test cases using docker in spring boot.In actual code it is working fine not giving any error but when i run test case for the…
Gunjan jha
  • 59
  • 5
3
votes
1 answer

JGit throws MissingObjectException and says missing unknown commit ID

I'm using JGit to extract diffs between two commits but I often face a problem that JGit throws MissingObjectException and says missing unknown commit ID like this: org.eclipse.jgit.errors.MissingObjectException: Missing unknown…
Jianlei Chi
  • 31
  • 1
  • 2
3
votes
2 answers

Netbeans JGit github password authentication deprecated,. how to reset?

I am using netbeans 8.2 to push to github but now get messages saying You recently used a password to access the repository at XXX with git using JGit/3.6.2.201501210735-r. Basic authentication using a password to Git is deprecated and will soon no…
tobi delbruck
  • 301
  • 2
  • 9
3
votes
0 answers

git blame -L with line range using jgit

I am looking for ways to optimize blame while using jgit (if its possible at all). When using git, this will give results for lines 40-60. git blame -L 40,60 foo I could use something like this to limit computing blame results: BlameGenerator bg =…
bdeo
  • 113
  • 1
  • 10
3
votes
0 answers

filter (git) diff output to contain only lines matching a pattern

Is it possible with either diff/git (or other common utility) to produce diffs that contain only changes matching a pattern? For example I have a file in two different versions: a/file.txt alpha marker 100 omega b/file.txt start marker 200 end I…
Peter Uhnak
  • 9,617
  • 5
  • 38
  • 51
3
votes
1 answer

Spring Cloud / Jgit / Github failing with SSH

Windows 10 Pro x64 JDK 11.0.6 spring-cloud-config-server 2.2.2.RELEASE I'm setting up Spring Cloud Config server. Works fine with a file system backend. Works fine with a https / basic auth github backend. Now I'm trying to set it up for SSH so I…
SledgeHammer
  • 7,338
  • 6
  • 41
  • 86
3
votes
1 answer

how to use bitbucket access token with JGit instead of user / pass

I'm googling without any luck about how to use bitbucket access token instead of user / password with JGit client library. The code below is about cloning a repo using a bitbucket user / pass.. How should I change this code to use bitbucket access…
Diego Arena
  • 134
  • 10