Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349404 - Directory XXX is not empty when creating new git repo
Summary: Directory XXX is not empty when creating new git repo
Status: RESOLVED WORKSFORME
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 0.12   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-15 03:18 EDT by Afriza N. Arief CLA
Modified: 2013-03-21 04:14 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Afriza N. Arief CLA 2011-06-15 03:18:22 EDT
Hi,

I have existing code and want to start tracking using EGit/JGit. When I tried to create a new git repo, I cannot continue because there is an error message "Directory XXX is not empty".

I think creating repo in a non-empty directory should be allowed as it is normally done in command line:

git init
git add .
git commit -m"Import existing code"

The checking should instead check whether the selected directory is already a git repo.

Regards,
Comment 1 Robin Rosenberg CLA 2011-06-19 16:38:01 EDT
You need to give more detail as it seems your procedure is what everybody else
does, and it works for us.
Comment 2 Afriza N. Arief CLA 2011-06-19 22:46:03 EDT
See the following youtube video for illustration of the problem for possible enhancement http://www.youtube.com/watch?v=NNJNhcbCMLo
Comment 3 Afriza N. Arief CLA 2011-06-20 02:01:36 EDT
Please see the following youtube video for illustration of the problem for possible
enhancement http://www.youtube.com/watch?v=btWjWXq2sz8
Comment 4 Michael Schnell CLA 2013-03-20 03:32:40 EDT
Instead of using the repository view to create the repository in the folder of the project, you could/should just use the "Share with git" wizard from the projects context menu.

* Context menu "Team" -> "Share Project..."
* Select "Git" and click "Next"
* Then select "Use or create repository in parent folder of project" which is exactly what you want to archive
* Select the project location
* Click "Create Repository", which creates the repository immediately

Using this wizard has also the advantage that EGit automatically knows that the project is shared using git. Otherwise you would have to use the "Share Project..." action and select the existing repository anyway.
Comment 5 Matthias Sohn CLA 2013-03-21 04:14:21 EDT
(In reply to comment #4)
> Instead of using the repository view to create the repository in the folder
> of the project, you could/should just use the "Share with git" wizard from
> the projects context menu.
> 
> * Context menu "Team" -> "Share Project..."
> * Select "Git" and click "Next"
> * Then select "Use or create repository in parent folder of project" which
> is exactly what you want to archive
> * Select the project location
> * Click "Create Repository", which creates the repository immediately
> 
> Using this wizard has also the advantage that EGit automatically knows that
> the project is shared using git. Otherwise you would have to use the "Share
> Project..." action and select the existing repository anyway.

exactly, this is the way how team providers connect an existing project to a repository