How to create new project from GIT repo using Eclipse EGit - eclipse

I have added a new GIT repo (private github repo) to Eclipse EGit repo explorer. In the working directory, our team has many projects - some python, some C++, some PHP - they are in different sub-directories. I choose a dir with python project and from the context menu I select "Import" then complete the steps with "New Project Wizard". I choose new "PyDev" project and end up with new project that is empty - only Eclipse files like the .project inside.
I want to create a new python project with the contents of ~/git/repo - I don't want external other copy of the tree.

You could follow this tutorial, and share your project.
That would create a local Git repo, to which you can add your private GitHub repo as a remote.
See also "Pushing a Local Repository to GitHub ".
Select your new Eclipse project and click "Team" > "Push To" and enter "Your GitHub Clone URL" and your GitHub password (with the free GitHub accounts, do not enter a password but leave blank), leave the user as "git"

Related

How to move Eclipse project from one Github repo to another?

I am new to github. I cloned my github repo to eclipse using EGit.
Now, I have two repo in my Eclipse.
I added my Java Eclipse project to the old repo. I would like to added my Java Eclipse project to new repo. How could I move my Eclipse project from one repo to another?
From eclipse, you can right click on a project and select the Team > Disconnect menu option to disassociate the project with the old git repository. Then right click the project again and select the Team > Share Project option. From the 'Configure Git Repository' dialog, you may need to uncheck the "Use or create repository in parent folder of project" check box. You will then be able to select the location of the git repository you want to associate with the project.

configuring github project with eclipse[EGIT]

I have configured Eclipse with GIT plugin and also created a repository in github
now i want to add all my existing project from eclipse to the github repository through eclipse plugin
Can someone please suggest the steps
I am able to checkin the projects, followed below steps
creating git hub workspace
open a git repository[window --> git repository]
click on clone a git repository
in the uri share github clone url https://github.com/******/scala.git
select the local workspace director in "Local destination" C:\software-Neon\Git-Workspace and click on finish
adding project
right click on project and then team --> share project
in the repository select the git repository created in step 2 and click on finish
right click on project and then team --> add to index
then right click on project and then team --> commit. enter commit messge then commit and push. [enter credential]
retrieving existing project from github
open Git repositories view
right click on Git-workspace then "pull" then finish
open package explorer then import --> Git --> projects from Git
select existing local repository -->workspace --> import existing eclipse projects
select the projects to be imported
6.click on finish

How can I start a project on GitLab repo with Eclipse?

Good morning.
I just create a GitLab private repo to work in a project with some people. When I add GitLab repo to Eclipse, it says there aren't projects (and it's true). I would know how to create a project and sync with online repo so other members can see my project and codes.
I tried to start a project in git\repoName\ folder, then right-click and choose Team->Commit, but changes wouldn't save (in gitLab repo's website, it says "Repo is empty").
I tried to follow some online guides, but without success.
Sorry for bad english!
Eclipse 4.2 and newer, comes default with (E)Git installed. There is a good Eclipse git tutorial from Vogella.
Create a GitLab git repository
Log into GitLab
Create a project / git repository
Copy the https url from the project, used for cloning
Adding an GitLab git repository in Eclipse
Open the Git perspective in Eclipse
Use Clone existing Git repo, as shown in Using git repository view
Now all the git functionality from Eclipse can be used.
I assume you have a cloned repository available in Eclipse (eGit) that is empty. If not, follow the steps in the answer from Verhagen.
By now, you have a cloned repository that is marked with "[NO HEAD]", indicating that no commit has been made.
Start creating a new project by using your project type of choice; I'll use Java project for simplicity: File menu > New > Java project
in the New Java Project wizard un-tick the "Use default Workspace location" checkbox; instead, choose the directory where you cloned your empty GitLab project, and append the name of the project (this is to make Eclipse create a directory inside the repository, just in case you later want to create more projects in the same repo).
Fill in the wizard as you usually do. When you are done with the different steps, you'll have a new project, that is also marked with "[NO HEAD]"
Create some source files you want to share (e.g. HelloWorld.java)
Synchronize workspace (right click on the new project > Team > Synchronize workspace) you will see that now there are files to commit. Pay attention to those files, since some of them ( .gitignore, and maybe .classpath, .project,.settings directory... depending on how you share your projects) you'll want to add to the .gitignore.
right click on the files you want to commit, fill in the commit message and click "Commit and Push". Click Next
Since it is a new repository, you'll have to configure the Push action. I selected HEAD as source and HEAD as destination. You might want to do the same, at least for this first commit+push; later on, you might choose to add some specs for branches, etc.
The Push Confirmation will show you that the new branch master:master will be created.
Both project and repository lost the "[NO HEAD]" marking
You can check gitlab site to confirm your files are there.

Importing projects in a BitBucket repository into Eclipse

I have a BitBucket repository that contains a directory of Eclipse projects, and I am having trouble importing those projects into Eclipse.
The files contained in the repository came from a Subversion repository. They were converted to a Git repository in the usual way, associated with the BitBucket repository using "git clone ", and the BitBucket repository was populated using "git push -u origin master". The Source tab of the repository in my BitBucket account shows all of the files that were contained in the original Subversion repository. To verify that the BitBucket repository was set up right, it did a "git clone " to a different local directory and verified that the new directory had the same files as the directory from which the files were pushed to the BitBucket repository.
Within this repository is a directory containing several Eclipse projects, and I need to import them into Eclipse. To do this, I installed the EGit plugin into Eclipse, switched to Eclipse's Git Repositories view, clicked "Clone a Git repository", entered the url of my BitBucket repository, specified my Workspace directory, and check a box labeled "Import all existing projects after clone finishes". When the clone and import were finished, all of the Eclipse projects were displayed in Eclipse's Package Explorer panel.
Some of the projects display all of their contents correctly, with a project folder containing, among other things, a src folder containing nested package folders that contained Java source files.
The problem is with the other projects, which display a project folder with a greater than ('>') sign between the folder icon and the project name, and a src folder with a greater than sign between the folder icon and the string "src". This folder contains no package folders and no Java source files. Eclipse documentation and forums say that these '>' signs are displayed when a file has been changed since it was last synchronized with a repository (although they mostly talk about these '>' signs being displayed for individual files, not for folders). I tried using the Eclipse command 'Team -> Synchronize Workspace' to make sure that the folders were synchronized, but it didn't change anything. Could anyone tell me what I did wrong along the way that prevents these projects from being imported into Eclipse correctly?
Thanks,
Mike

How can I add current Eclipse project to git with EGit?

I have GAE project in my Eclipse and I want to add it to my local git repo, how can I do that?
Since creating a Git repo within a GAE project is possible through command line, it is possible through Egit:
Follow that Egit tutorial:
For a new repo:
Right click your project, select Team -> Share -> Git.
Select the proposed line and press "Create repository". Press finish
Create the file ".gitignore" in your project with the following content.
All files / directories which apply to the pattern described in this file will be ignored
But you can also add it to an existing local repo by:
making a special branch for your project in your local repo (with just the .gitignore file in it)
clone it where your current project is
add all your current project files in it
import said Git repo into your workspace: See 4.2 Clone existing project.
informatik01 adds in the comment a link to a short article describing how to do it using the command line:
Adding Eclipse Project to Git
cd ~/workspace/my-project
git init .