Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree. [message #941338] Fri, 12 October 2012 12:21 Go to next message
Eugene   is currently offline Eugene Friend
Messages: 26
Registered: July 2009
Junior Member
Hi,

I'm getting subj in following setup:


Repository created with (git version 1.7.9.5):

git init --bare --shared


Then it is cloned with following code (jgit version 2.0.0.201206130900-r):

 File projectDir = new File(dir, name);

 CloneCommand cloneCommand = Git.cloneRepository();
 cloneCommand.setURI("git@localhost:/opt/git/"+name);
 cloneCommand.setDirectory(projectDir);

 git = cloneCommand.call();

 createGitIgnore(projectDir);

 AddCommand addCommand = git.add();
 addCommand.addFilepattern(".gitignore");
 addCommand.call();

 CommitCommand commit = git.commit();
 commit.setMessage("gitignore");
 commit.call();


and then in proj Dir i'm getting:
$ git diff origin/master
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions


If I understood h t t p : //osdir.com/ml/git/2009-11/msg00651.html correctly this error means that server and client are of different versions. If so, is there any jgit-git compatibility info?

Best regards, Eugene.
Re: fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree. [message #941437 is a reply to message #941338] Fri, 12 October 2012 14:22 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior Member
If I do exactly what you describe I get the same behaviour even with native git. The problem is that your original repo is empty. No HEAD, no master branch. Therefore also the clone is empty and has no ref called origin/master. That's what I executed (please look at the warning about empty repo when cloning with native git):

> cd repo1
> git init --bare --shared
Initialized empty shared Git repository in c:/git/tmp/z9/repo1/
> cd ..
> git clone --no-hardlinks repo1 repo2
Cloning into repo2...
done.
warning: You appear to have cloned an empty repository.
> cd repo2
> git diff origin/master
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions


Ciao
Chris
Re: fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree. [message #941444 is a reply to message #941338] Fri, 12 October 2012 14:26 Go to previous message
Eugene   is currently offline Eugene Friend
Messages: 26
Registered: July 2009
Junior Member
Ok, now it's clear. Thank you for explaining!
Previous Topic:How to clone or checkout a specific branch ?
Next Topic:configure display of latest branch commit?
Goto Forum:
  


Current Time: Fri Apr 19 19:32:55 GMT 2024

Powered by FUDForum. Page generated in 0.03449 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top