Thursday, February 1, 2018

Share an Eclipse Project to GitHub in 2 Steps

If you have a project in your eclipse workspace and you want to share it on GitHub, how to do it? Very simple!
Assuming you already registered a GitHub account and you have already installed git on your computer, you can share your eclipse projects to GitHub in 2 easy steps. following approach works for Mac, Linux, and Windows (assuming you have installed cygwin on your windows). If you use BigBucket instead of Github, it is exactly the same!
Step 1: Create a new repository on GitHub



Click the green button and you will see the following page:








You can input only repository name, e.g., "restful-client", and leave others as default.
Step 2: Run the following command lines
On your computer, cd to your project directory in eclipse workspace, and then type the following command lines one by one.

The "init" command initiates a new git repository in the project directory.
When are done, you need to register the new repository with a remote (where you'll upload -- push -- your files to). In this case, the remote is Github. You'll need to get the correct URL for your repository on GitHub.
Type in command line:

In my case, it is [username] is "ryanlr" and [reponame] is "face-collage-maker". So the URL is "git remote add origin https://github.com/ryanlr/face-collage-maker.git"
Now, add all files to your local commit:

Then make an initial commit:








This stages your files locally for commit, but they have NOT actually been pushed yet. You've created a commit in your local repository, but not in the remote one. To put it on the remote, do:


No comments:

Post a Comment

Recent Post

Databricks Delta table merge Example

here's some sample code that demonstrates a merge operation on a Delta table using PySpark:   from pyspark.sql import SparkSession # cre...