Git upload an existing project
Starting from our
AppHowToProjectSetup manual this explains how to create a new gitea repository and upload the source code.
Please make sure to read
AppHowToGitInEclipseForBeginners at least up to and including 2.1.
We will create a project in our personal git organisation which can later be move to one of the bigger organisations like fcc-applications or fcc-commons.
Create the gitea project
Visit
https://git.acc.gsi.de/ and Please follow the screenshots.
- Owner: You name
- Chose a repository name that resembles or even is the same as the maven artifact name
- Private repository is only if you want to hide the project, none of your collegues will be able to see the project
- Leave the gitignore, license and especially the "initialize repository" option empty. We already have code that we want to upload and don't want do get any conflict
- Hit "Create Repository"
3. Repository created, copy URL
- Repository created successfully - make sure to copy the marked http repository URL.
4. Initialize the local git repository
Now we have to do some command line work. Open a bash shell and navigate to the source files of your project. (To get the path, in Eclipse: select
Project -> Properties -> Location
might help you)
Enter the following commands from the main project directory (were
pom.xml
is)
cd DIRECTORY_OF_THE_PROJECT
git init
# download a default gitignore file that will prevent eclipse project files from being uploaded
wget https://git.acc.gsi.de/buildsystem-common/csco-java-fx-template/raw/branch/main/.gitignore
# Adjust the complete URL to the previously copied one
git remote add origin https://git.acc.gsi.de/REPLACE_COMPLETE_WITH_THE_URL_YOU_HAVE_COPIED_BEFORE
# Add and commit all these changes with the following commands
git add -A
git commit -m 'Initial commit'
# We will then push the changes using eclipse in the next step
5. Push the repository using eclipse
- Now we switch back to eclipse, select our project in the repository explorer and do a
"-> refresh"
or hit F5
while the project is selected
- Select
Team -> Push Branch "master"...
- (highlighted blue in the screenshot below)
- if you only have the options "Apply patch", "Share Project", and "Share Projects", choose "Share Project", select GIT and finish, repeate step 2
- There might be a prompt for your local
keystore
password, enter it or cancel the keystore
dialog
- Click on
Preview
and Push
in the following dialog pages
6. Success
You can see an entry in your eclipse "history" view now and if you refresh you gitea project page.