Priv
Priv

Reputation: 840

Using EGit and GitLab for multiple projects

I have started using EGit with Eclipse Oxygen and GitLab today. I have two projects and two different repositories on GitLab. However I'm unsure how to properly connect each project to its repository. In Eclipse > Settings > Git > Configuration > Repository Settings I have managed to set one url in remote > origin > url. But I have no idea how to set a different url for the other project.

I have the first project successfully uploaded to GitLab now, but GitLab shows the files under Desktop/some/other/path/MyProject, where my project is located on my computer, but I want GitLab to just show all files and the src folder on the "main" page. How do I tell it to do that?

I have been googling for quite a while and looked at some EGit tutorials but I couldn't find out how to do this. I'm a newbie to this stuff, so I'd appreciate some explanation. Thanks.

Upvotes: 1

Views: 285

Answers (1)

VonC
VonC

Reputation: 1324505

You need to make sure that each of your project has its own .git subfolder in it.

cd /path/to/project1
git init .
git remote add origin https://github.com/<me>/project1

cd /path/to/project2
git init .
git remote add origin https://github.com/<me>/project2

Then you can import those two projects in your Eclipse workspace and use Team Share on each imported project: Eclipse will recognize the existing Git repo and their remote origin URL automatically

Upvotes: 1

Related Questions