Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Question about pulling and fetching

On Wed, Apr 9, 2014 at 7:41 PM, Andres Felipe Gomez Mogollon <anfgomezmo@xxxxxxxxx> wrote:
Hello,

I am trying to pull from a remote repo usning the JGit library in a Java Application. AS a test I cloned a test repo and then tried to pull but I am getting an exception

Exception in thread "main" org.eclipse.jgit.api.errors.NoHeadException: Pull on repository without HEAD currently not supported
    at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:161)
    at org.dstadler.jgit.unfinished.PullRemoteRepository.main(PullRemoteRepository.java:38)


Can someone help me with a small code or advice that show me how to pull or fetch from a remote repo??.

this error is raised if the repository you are trying to run a pull command for has no HEAD.
Checkout a branch before pulling. Pull will fetch updates from the remote repository identified
by the remote you passed to setRemote() and merge the branch you specified with 
setRemoteBranchName(). If you didn't call setRemoteBranchName jgit will use the checked out
branch's configuration to determine which branch to merge into the currently checked out branch.

See PullCommandTest for examples.

--
Matthias 

Back to the top