957 questions
0
votes
0
answers
53
views
Creating directories for */.git failed
I used JGit library for cloning and pulling repository in my app.
Git clone code:
Git.cloneRepository()
.setURI(remoteURL)
.setDirectory(repoDir)
...
0
votes
0
answers
39
views
git sparseCheckout with jgit
I have been trying to clone necessary folders and subFolders from git using jgit for spring boot rest api but according to my findings there is no direct or indirect way to do so with jgit. Is there ...
0
votes
0
answers
44
views
Fetch LFS file from remote to new local repository with JGit
I want to fetch remote repo with LFS files with FetchCommand to newly created bare repository.
I've tried something like that:
try (Git git = new Git(repository)) {
FetchResult result = git.fetch()...
0
votes
0
answers
27
views
jGit get ObjectId's of conflicting file
I use jGit and the status() command to list the conflicting files.
I want to load the two versions of a file in status CONFLICTING, and solve the conflict by myself. OpenAI suggested the code below.
...
1
vote
0
answers
44
views
how to specify the author of commit created by revert() in JGit?
Suppose there is a file that is added and committed to a Git repository with the change reverted:
try (Git gitParent = Git.init().setDirectory(parentRepositoryRoot).call()) {
final String fooName =...
0
votes
0
answers
58
views
Git's built-in garbage collection vs JGit handling of garbage collection operation ( Built-in Git vs JGit garbage collection mechanism)
Here are the few points :
Git's built-in mechanism automatically triggers the git gc when the number of loose objects are high or it detects repository size is huge and objects should be garbage ...
0
votes
0
answers
27
views
Different result between JGit diff and git diff
I'm trying to get differences of two commits in Java by JGit library. Here is my code:
public static void getDiffBlocks2(Git git, String javaFilePath) throws IOException {
Repository ...
0
votes
0
answers
35
views
Can I get the repo URL from the tag url or branch url or commit url?
I have a requirement in which my client is required to clone the repository on the client machine. The repositories can be of Git/GibLab or BitBucket. From each of the URLs I need to get the repo URL ...
0
votes
0
answers
36
views
How do I check jgit setCloneAllBranches() clones all branches to my local [duplicate]
I am trying to clone a git repository into my local using the following code:
repo = Git.cloneRepository()
.setCloneAllBranches(true)
.setBranch(branch)
.setCredentialsProvider(new ...
0
votes
0
answers
45
views
Can JGIT be configured to show git commands being executed
I'm trying to checkout the latest from a remote branch using JGIT, unfortunately it doesn't seem to be working. Was just wondering if JGIT can echo the commands which are being executed. Does the code ...
0
votes
0
answers
60
views
wrong commit info of jgit blame
I have a file , the git blame info of git command git blame a.java like this:
just like the blame info of Jetbrains IDEA "Annotate with Git Blame".
But when I use jgit "BlameCommand&...
0
votes
0
answers
64
views
Any JGit DFSRepository implementation with database
I am experimenting with creating a JGit DFSRepository implementation with a database. From what I understand so far, I need to implement DfsObjDatabase, DfsRefDatabase.
So far I have started ...
1
vote
1
answer
152
views
Initialize an InMemoryRepository with Jgit from scratch
I am trying to create an InMemoryGitRepository from scratch. Ultimately, I would like to try a custom DFSRepository as git backend, but to begin with I was playing around with the default ...
0
votes
1
answer
60
views
JGit, remove tags no longer in remote
This is a question specific to the JGit api.
I would like to replicate in JGit the same behavior of the following Git command:
git fetch --prune --prune-tags, which basically removes, from the local ...
0
votes
0
answers
30
views
Jgit Fixup, Squash Interactive Rebase is not working properly
Jgit Fixup Interactive Rebase is not work properly
What I want
before
commit: A - B - C - D - E - F
after
commit: A(+B+C+D) - E - F
In Git Cli
git rebase -i commitA
pick 70b72153 A
fixup 96e62976 ...
0
votes
0
answers
36
views
Git clone failed with Krb5LoginModule error - JNA Library
Insights : -
I am performing https git clone operation on Azure repository and the request is failing with kerberos auth failure. I am not sure if I am using kerberos internally in my application but ...
0
votes
0
answers
25
views
jGit Push not always visible in GitHub Activity page
I use jGit to manage repositories, and I have a question related to push().
The issue: not all pushes are visible in the GitHub activity page.
In the workflow below, Ben is pushing a change to GitHub ...
0
votes
1
answer
198
views
CONNECT through proxy removes additional headers required for authorization
I am using Jgit library to provide git functionality in our application. When a git operation like clone is executed for cloning HTTPS repo, the request needs to go through an embedded jetty based ...
0
votes
1
answer
110
views
In java JGit, How to remove all commits from remote repository except the most recent one
I am using eclipse JGit API on my java project to mange remote GitHub repository and so far I can use JGit to commit local changes to remote. But I have these requirements that I will only need to ...
1
vote
2
answers
194
views
JGit and blobless clone: unable to fetch blobs later
Unable to use JGit to do some operations on a blobless clone that I can do via Git on the command line. Specifically unable to get the blobs later. For example, consider the following sequence of Git ...
0
votes
1
answer
187
views
Static Code Analysis using Java, JGit, PMD
I am trying to clone the repository from the github, do a local clone and do static code analysis on the java source code. Finally write the results into the CSV file.
Exception in thread "main&...
0
votes
1
answer
30
views
jGIT Track File Location Change
A GIT file location may change through GIT PULL or change of the branches.
How can I track the file position change?
I am using jGIT, an Eclipse library for GIT.
Currently I do:
final PullCommand ...
0
votes
0
answers
52
views
How does Jgit obtain the code diff information of the historical commitid that has been rebased?
A branch has been rebased or reseted, and I want to get the code version of a certain commit before rebase. When I query the commit, an error will be reported
org.eclipse.jgit.errors....
-1
votes
1
answer
162
views
Create git repo with jgit and put a file into it
I have the following code to generate a new git repo and put a .gitignore into it:
Repository repo = new FileRepositoryBuilder().setGitDir(gitProjectDir.toFile())
.setWorkTree(gitProjectDir....
1
vote
2
answers
292
views
How to use JGit to view modifications in the local workspace?
I can use JGit to view differences between different commits or different branches, but I don't know how to compare uncommitted files with HEAD.
I have searched through the JGit Cookbook, but I still ...
0
votes
1
answer
194
views
JGit failure in Cloning repository
I am currently facing an issue in JGit with Cloning repository.
I used CloneCommand object to clone a my own public repository but it failed.
I got these messages from a ProgressMonitor
-remote: ...
1
vote
0
answers
214
views
Spring config server ssh git connection through proxy since boot 3.x is failing
My team uses the spring config server to connect to a git repository that has most of our services configuration.
We decided to upgrade our config server to Spring boot from 2.7.2 to 3.1.0 and we also ...
1
vote
2
answers
386
views
Check out single subdirectory from minimal repository using JGit
I'm using JGit 6.5.x with Java 17. I have a remote repository that is huge (gigabytes), but I only need temporary access to a single subdirectory (e.g. foo/bar/) for processing. The single ...
1
vote
1
answer
123
views
Using JGit to modify a repo doesn't change anything even after committing
Here is my code:
postbody = usabled;
String pathToClone = "./repo";
Git git = Git.cloneRepository()
...
1
vote
1
answer
1k
views
How to use custom credentials while using JGit?
I am using JGit in my spring-boot application for performing git operations. I need to use the test account for the git operations - The commit should be from test account
I am using below steps to ...
1
vote
1
answer
63
views
JGit is causing duplicate classes error out of the box
Attempting to integrate JGit into an Android project and getting lots of duplicate classes ERRORs all coming from JGit transitive dependency:
Duplicate class detect shows among others:
- org/...
0
votes
1
answer
185
views
JGIT Push takes a long time to add an empty commit (no changes) when executed from a Cloud system, but almost no time in a VM
Context:
I'm using JGIT 6.5.202303070854-r in a custom application that runs as a plugin inside another Java app inside Tomcat. For all intents and purposes it's a normal Java implementation.
The end ...
1
vote
2
answers
366
views
How to get file by ObjectId in jgit
I have some objectId from each files in my directory and some time after I want to find this file by objectId.
I can make it only like hard way... but maybe there is/are some another solution/s ?
This ...
1
vote
0
answers
109
views
jGit and Dirty Worktree
If I do pull and one of the local files are modified, I may get an exeception with status 'DIRTY_WORKTREE'.
Which is the best approach to avoid this? What I did:
MergeResult mergeResult = git.pull()....
0
votes
0
answers
35
views
How to download git repository via java code [duplicate]
i need to download files from git repository to directory via java code, and i have error witch my code when the download begins
private void downloading() throws GitAPIException {
String ...
1
vote
0
answers
27
views
how to set up reading a remote private github respository
I'm trying to walk a remote private git repository and list all the folders, subfolders, and files. The code I use is below, as well as the authorization exception.
Code:
package com.example....
0
votes
1
answer
91
views
JGit commiting with past (old) dates to local repository
I would like to commit in a specific date in the past using JGit in Java. For example, I would like to commit to the local repository in 2023-03-01, 2023-03-02, 2023-03-03, 2023-03-04. According to ...
0
votes
1
answer
868
views
JGit cannot clone Github repository
I'm trying to clone a private Github project, using JGit, as follows:
CloneCommand cloneCommand = Git.cloneRepository();
cloneCommand.setURI( "https://github.com/xxx/testing.git" );
...
1
vote
2
answers
5k
views
JGit authorization problems [Caused by: org.eclipse.jgit.api.errors.TransportException: https://github.com/ ... .git: not authorized]
My very-very simple test code always fails. I cannot get access to my own repository (PRIVATE) (it is completely new and empty). The username and password are perfectly working I tested signing in and ...
1
vote
0
answers
35
views
jGit - Copy File Lastest Version from Remote GIT Server
I try to read the latest version of a file from the GIT server. Somehow this picks up the wrong version. Could you please help?
public void copyFileToOutputStream(Repository repository, String ...
2
votes
1
answer
364
views
Jgit Bug? Git clone command works even if incorrect username is passed with UsernamePasswordCredentialsProvider
While trying to clone a repo with jgit, passing wrong username to UsernamePasswordCredentialsProvider actually does not result in any error, which is very surprising to me. Why is it working? How is ...
1
vote
1
answer
173
views
Push Git Repository as new repository to Gitlab with jgit
I have a git repository on my computer and want to push it as new git repository to a Gitlab instance.
I tried:
Path tempCloneDir = Files.createTempDirectory("git");
Git git = Git....
0
votes
1
answer
173
views
How to push to bitbucket using jgit
I am trying to push code to bitbucket using jgit. Clone is working with ssh, but to push - I need to set credentials and I am getting "not authorized " error. I tried username, password, (&...
1
vote
1
answer
193
views
jGIT Detect Conflicts by Commit&Push and Pull
Beside merging branches, GIT can have conflicts by
Commit/Push ( if a file in GIT has been modified meanwhile
by Pull, if the local file has been modified by me.
How can I list this conflicts before ...
3
votes
1
answer
86
views
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 &...
0
votes
1
answer
705
views
Jgit - checkout from a specific branch
I am using jgit. I want to create and checkout a new branch. I have seen the git.checkout.createnewbranch command. Is there a way to specify the base branch for the checkout, say "test" (or) ...
0
votes
0
answers
208
views
jgit - files not getting added to the github repo
i tried the jgit to add files to the github repo. Commit is getting created, but the files are not added, In addfilepattern - i tried "." as well. I have commented pull as i am facing error ...
0
votes
0
answers
123
views
Eclipse ignoring the git hooks
Is there a way to make the eclipse read the hooks created from .git/hooks directory? I tried to use the hooks on cli/shell level and it’s working as expected but on eclipse ide,it completely ignores ...
0
votes
0
answers
172
views
Execution default-cli of goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-start failed: String index out of range: -6
my project uses jgit to release the code to artifactory , how ever suddenly am facing the issue as Execution default-cli of goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-...
0
votes
0
answers
874
views
Failed to start websocket connection
When I execute my Jenkins pipeline, during the repository clone stage, it crashes and the error message is:
Failed to start websocket connection io.fabric8.kubernetes.client
Not sure if it's because ...