I want to create a new Maven project in Eclipse and push it to a new repository on github. I am a bit stuck on the right order of steps to achieve this.
I found a lot of information about cloning from github, but my github repository does not have a Maven project yet, so I cannot import in Eclipse. If I use command line instead and an empty directory, I cannot apply Maven archetypes any more because the directory is not empty.
I am confused. Can somebody de-confuse me?
git init
. This will create the local repository inside that directory. $ git remote add origin https://github.com/user/repo.git
(optionally replace origin
for the name your remote repository is going to be called, also replace user
for your github username and repo
for the name of your github repository name) For example
$ git add .
# Adds the file to your local repository and stages it for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
For example:
$ git commit -m "Add existing file"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
Just be clear, taking the following structure as reference, What I propose is to have as git repositories any of the directories project1
, project2
, projectN
, not the whole worspace ( /roo_dir/workspace/
directory).
/roo_dir/workspace/
- project1
- project2
- projectN
Additional readings:
Try this
Finally, I did the following:
The workflow is generally the one suggested by @lealceldeiro, but without using the command line git.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.