To answer this question involves three steps.
- Create a external (remote) repository
- Share the project in a way that it remains in the workspace
- Connect the project repository to the remote repository
Create a Remote Repository on Your Local Machine
Switch to the Git perspective. Click on Create a new Git Repository.
When a dialog appears select a directory where you would like your remote
repository to be. This is were your project will be push
ed to. You will also
want to select the Create as a bare repository option.

That's it for this step. You should now have this repository in your EGit
repositories list.
Sharing Project within the Workspace
There are two ways to share a project so that it remains in your workspace.
1. Make the project directory a repository
2. Make the whole workspace directory a repository
The Project as a Repository
The first option option is not recommended by the Eclipse team. This issue is
described in more detail at Why is not recommended to have an Eclipse project folder as a Git repository?.
The basics of the issue are twofold:
- You can't have more than one project per repository
- If some thing happens to your workspace you'll lose your repository too
Issue 1 isn't solved here. Issue 2 can be solved by connecting to a remote
repository as show later.
To share the project as a repository:
- Right click on the project
- Select Team -> Share Project... from the popup menu
- Click Use or create repository in parent folder of project

- Select the project from the list
- Click on the Create Repository button
- Click the Finish button
Next you'll want to connect your newly created repository to the remote repository.
That's covered below.
The Workspace as Repository
The second options allows multiple projects to be added to your repository.
In fact any new project you create will automatically added to the repository.
Automatically adding projects can cause some issues.
One issue is that, if there are changes in multiple projects, staging
those changes can take a bit of wading through. Using a Tree presentation when
staging can simplify things.
Another more serious issue occurs when importing a git clone of a project into
the workspace. This importing will create nested repositories. Nested
repositories can cause problems
according to this post.
By default Eclipse doesn't import the git clone of the project into the workspace.
To share the workspace as a repository:
- Right click on the project
- Select Team -> Share Project... from the popup menu
- Click on the Create button
- Select your workspace as your Repository directory
- Click the Finish button
Once your repository is created you may want to do a little house keeping. I suggest
adding the RemoteSystemsTempFiles
project to the .gitignore
file. Note: the
.metadata
file is added automatically by Eclipse.
You can ignore the RemoteSystemsTempFiles
by:
- Switching to the EGit perspecitive
- Selecting the workspace repository from the list of repositories
- Select the Git Staging tab
- Click on the View Menu button on the right side the the tabs toolbar
- Select Presentation -> Tree menu (folders are easier to ignore form the tree view)

- Right click on the
RemoteSystemsTempFiles
project
- Select the Ignore Folder menu
- Ignore other projects in the same way
Connecting to the Remote Repository
The last stage is connecting the workspace repository to the remote repository
we created earlier. Once you've switched to the EGit perspective:
- Expand your workspace respository
- Right click on the Remote node in the tree
- Select the Create remote... menu
- Leave the remote name as origin
- Select Configure fetch
- Press Ok
- Click on the Change... button
- Click on the Local File button
- Select the bare repository that you created in the first section
- Click Finish
- Click Save and Fetch and then Ok

You can then stage, commit and push changes in your projects and workspace.
When you first commit and push EGit will push the default branch master
to the remote and configure pull
ing this branch from remote repository.