Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Java Project Git Tag Changed From master to NO-HEAD(eGit status has changed from master to NO-HEAD)
Java Project Git Tag Changed From master to NO-HEAD [message #1584958] Mon, 26 January 2015 02:52 Go to next message
Ron Westfall is currently offline Ron WestfallFriend
Messages: 3
Registered: January 2015
Junior Member
I have a number of Java projects that have been added to eGit. The git repository for each project resides in a directory GitRepositories. For a project Foo, the git repository is located in .../GitRepositories/Foo.

Many of the projects have a short history of commits after the initial commit. In the package explorer, after the projects were initially committed, eGit displays a short string next to the project (e.g. [Foo master]).

For some of my projects, the short string next to the project has now changed to [GitRepositories NO-HEAD]. When a change is made to a file in the project, you no longer get the > next to the file when the code change is saved.

If you right click on the project, select Properties and select Git, the project would have originally displayed:

Git directory: .../GitRepositories/Foo/.git
Working directory: .../GitRepositories/Foo

Now some of the projects display:

Git directory: .../GitRepositories/.git
Working directory: .../GitRepositories

The directory structure of the git repositories has not changed.

Anybody know what has happened? More important, does anybody know how to get the project configured correctly?

Re: Java Project Git Tag Changed From master to NO-HEAD [message #1585293 is a reply to message #1584958] Mon, 26 January 2015 07:23 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
This happens if the repository's HEAD (pointer to the currently checked out branch, sometimes to
a directly checked out commit or tag) is missing or points to nowhere.

Does your repository's .git folder contain a file named "HEAD" ? If yes, what's the content of this file ?
What's the output of "git status" on this repository ?
Re: Java Project Git Tag Changed From master to NO-HEAD [message #1586299 is a reply to message #1585293] Mon, 26 January 2015 19:45 Go to previous messageGo to next message
Ron Westfall is currently offline Ron WestfallFriend
Messages: 3
Registered: January 2015
Junior Member
What seems to have happened is that eGit now mistakenly thinks that project Foo is in directory .../GitRepositories rather than the proper .../GitRepositories/Foo.

There is a .../GitRepositories/.git, which is nonsensical since GitRepositories contains multiple separately controlled projects. It appears to have been created on January 17. It is a mostly empty hierarchy of directories. The HEAD file contains:

ref: refs/heads/master

There is no refs/heads/master file.

If I look at one of my projects (e.g. .../GitRepositories/Foo), there is a .git directory there as expected and proper. The HEAD file also contains:

ref: refs/heads/master

In this case however, there is a refs/heads/master file that contains a proper object reference: 6b2ae59c7bb853ea8fdbf9c7e4a38a8f937c869a.

Another interesting symptom is that Eclipse seems to know that the project is in .../GitRepositories/Foo. I had first noticed something was wrong when a file edit on a previously committed file did not result in the > being displayed in front of the file name to indicate that a commit was needed. I have discovered though that Eclipse has been happily storing the updates in the proper source code file in .../GitRepositories/Foo/Foo/src/com/...
Re: Java Project Git Tag Changed From master to NO-HEAD [message #1586662 is a reply to message #1586299] Tue, 27 January 2015 00:25 Go to previous message
Ron Westfall is currently offline Ron WestfallFriend
Messages: 3
Registered: January 2015
Junior Member
I have resolved the problem.

I right clicked on the project and used Team -> Disconnect to disconnect eGit from the repository. I then right clicked on the project and used Delete (without removing project content from disk!!!) to remove the project from Eclipse.

I then used the Eclipse File menu to import a Git project from an existing local repository (.../GitRepositories/Foo/.git).

Once I had done this for all of my projects, I deleted the empty .../GitRepositories/.git directory that had mysteriously been created.

I still don't know how the problem occurred in the first place. I had upgraded to Luna recently, but I am not sure if I had done this near the time when this problem showed up.
Previous Topic:Unable to upgrade Eclipse Luna due to missing repositories
Next Topic:is there any way to pull a subdirectory from a git repo using jGit
Goto Forum:
  


Current Time: Thu Apr 18 10:16:07 GMT 2024

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

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

Back to the top