Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8537357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:53:00+00:00 2026-06-11T10:53:00+00:00

I understand the concept of Git fetch. I would like to fetch objects through

  • 0

I understand the concept of Git fetch. I would like to fetch objects through the FetchCommand class in the JGit API.

I have a Git repository. For example C:\jGit\.git.

I have cloned this repository. For example: C:\jGitClone\jGit\.git.

I have cloned this repository again. For example C:\Users\user\Desktop\jGitClone\.git.

Using the JGit API I have a Git class:

Git git = new Git(repository); // this is the cloned repository. C:\jGitClone\jGit\.git

How would I set the cloned repository which is on the desktop so when the fetch is called it knows to fetch into the this repository.

I have looked on some websites including the 1 below but still stuck.

Git fetch failing using jgit: Remote does not have <branchname> available for fetch

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:53:01+00:00Added an answer on June 11, 2026 at 10:53 am

    I think you missed something. in Git/jGit, a local copy is determined by a path (like in a file system), and a remote, which is a distant repo.

    In your case, you want that your desktop cloned repo has a link to your jGitClone/jGit repo. So first, if the cloning is already done, then the desktop repo knows about its remote repo. So in your code, you just need to tell where your desktop repo is:

    Builder builder = new FileRepositoryBuilder()
    Git repo = builder.setGitDir(new File("C:\Users\user\Desktop\jGitClone.git"))
      .readEnvironment()
      .build()
    

    The code might not be directly working (I didn’t test it, the doubts I have are on the path to give, and the objects to use: Builder, Git), but it’s based on this answer that I think will help you: JGit and finding the Head

    By the way, your question is not that clear : did you already clone everything or is it what you want to do? in your code you mention a repository : did you obtain it using code similar to what I suggested? The names you chose are not very clear either : calling a repo jGit, unless it contains jGit source code, sounds a bit clumsy. Plus, give names to your different repos (A,B,C) to have a clearer understanding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a command-line tool that uses sub-commands much like Mercurial, Git, Subversion
I didn't fully understand the concept of threads I have some questions. Assume we
I can't really understand this concept. Assuming i have this interface: public interface IValidate
I want to understand the concept of the TSource, Tkey by the example. We
I am trying to understand the concept behind the for loop example for (;;)
I understand the concept of database normalization, but always have a hard time explaining
I understand the concept and reasons behind using the using statement, and I use
I am trying to understand the concept of currying and calling a function which
I am trying to understand the concept of timestamps in request headers in web
I'm trying to better understand the concept of 'autocommit' when working with a Postgres

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.