hide0
hide0

Reputation: 424

Eclipse + Egit - adding a new Java project to a remote repository

I have a Java project in Eclipse that I maintain using a local git repository (The repository has only that one project).

I've been asked to push this project to a remote git repository. This repository already has other projects in it (and apparently the plan is to maintain all my team's projects in this repository).

How would I go about doing this using Eclipse and Egit? (Alternatively, I wouldn't mind doing this on the command line as well).

When I tried the "normal" procedure for pushing a project using Egit (Right-click project -> Team -> Remote -> Push) I get an error "master: master [rejected - non-fast-forward].

Upvotes: 1

Views: 1850

Answers (2)

Andreas Linden
Andreas Linden

Reputation: 12721

do the following and replace the <tags> with your data

git clone <git_url> <foldername>
cd <foldername>
git checkout -b <new_project_name>
<copy all your files to the folder>
git push origin <new_project_name>

Upvotes: 1

Jonatan
Jonatan

Reputation: 2886

Try doing a git pull to sync up with the remote repository, then you should be able to push to it. The non-fast-forward most likely means you have an old copy checked out.

Upvotes: 3

Related Questions