Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't add new file to repository in EGit

I'm using EGit with Eclipse Juno. I worked with a local repository and the world was good. Even adding a GitHub repository seemed to be fine. I added it to my local repository under "Remotes", so I can easily push commits to github. But after a while, I noticed that no new files are added to the repository, even if I'm commiting changes. They just are not under version control. They have no symbol, which should mean they are ignored. This is my .ignore

.gwt
gwt-unitC
ache
Versandanzeige_Web_proto.war
Versandanzeige_Web.war
war/ajax
war/WEB-INF/classes
war/WEB-INF/deploy
www-test
  • The files are in src, so not even close.
  • The new files don't appear in the Commit-Dialog, even when checking "show untracked files". They don't appear in the Staging-Window.
  • RK -> Team -> "Add to index" doesn't help.
  • The files have the same right and are owned by the same user
  • They definetly dont show up at github

Any ideas how to fix that? Any additional information needed?

Update: There are no errors in the error log.

I do have (HEAD) next to my newest branch.

More details: I got my trunk T, beginning at T0. At T1, there is a branch A, which has changes to T1. At T2, there is another branch, B. It has no changes to T2. The strange thing: it is not indicated in History view. The master branch is also missing. I can still switch to them. When I do git reflog, there are no entries before or including T2, just everything afterwards.
I removed the branches without commits: enter image description hereenter image description hereenter image description here

The new files are still shown as ignored:
enter image description here

Output from command line:

$ git branch -a: 
* master 
maven 

$ git status 
# On branch master nothing to commit (working directory clean)

About the detached HEAD proposel: I didn't do what is described in the article, checking out an old state and work from that. And I can't see any undone commits.

Sorry for my bad english, I didn't use it for a while. Please ask for clarification, if I write something hard to understand.

Update: I could add a file in another folder (/Versandanzeige_Web/war/WEB-INF/lib/gwt-servlet.jar).

like image 353
Markus Avatar asked Oct 09 '12 21:10

Markus


People also ask

How do you create a new file in a repository?

In your repository, browse to the folder where you want to create a file. Above the list of files, using the Add file drop-down, click Create new file. In the file name field, type the name and extension for the file. To create subdirectories, type the / directory separator.

How do I add files to a GitHub repository folder?

On your computer, move the file you'd like to upload to GitHub into the local directory that was created when you cloned the repository. Open Terminal . Change the current working directory to your local repository. Stage the file for commit to your local repository.

How do I create a new branch in EGit?

To create a new branch in your repository, right click a shared project and navigate to Team => Switch to => New Branch… from the context menu. Select the branch you want to create a new branch from, hit New branch and enter a name for the new branch. The new branch should appear in the branch selection window.


2 Answers

Alright, I found the error. For some reason I don't really know, there was another .gitignore file ABOVE my Project folder (in repository folder), where my COMPLETE project folder was included. I really don't know how that happened. Of course, this file didn't show up in Eclipse. I tried to add the files on the command line, but gut the error message "File is in .gitignore file". After deleting that file, it worked find. Sorry for the trouble.

like image 183
Markus Avatar answered Sep 20 '22 07:09

Markus


Sometimes EGit does not work properly and add to index does not work. In that kind of situations you can go to the root folder of your project (where .git folder is placed) with a file explorer, right click on an empty area inside the folder, select "git bash". This will open the git console for you. Now type "git add path_to_file". This will add the file to the git system for indexing. Now go and refresh your project in eclipse and you will see it is added to the index. This can be used wile resolving conflicts inside eclipse because adding to the index indicates "mark as merged" to the git system by re-adding the merged file.

Also sometimes the "Remove from index" does not work in eclipse, you can do the same thing in that kind of situation: this time write "git remove --cached -f path_to_file". Here do not forget to add "--cached" because otherwise your file will be deleted. -f stands for "force" to force the command. For any folder (directory) to remove from index type "git remove --cached -r -f path_to_folder".

like image 32
Bahadir Tasdemir Avatar answered Sep 23 '22 07:09

Bahadir Tasdemir