Home  »  ArticlesGuidesTechnologyTools   »   How to add Existing Project to GitHub Account

How to add Existing Project to GitHub Account

GitHub is an online service that provides Internet hosting for software development and version control using Git. To add an existing project to GitHub accounts would be something you would get on board with.

This is done by offering the distributed version control and source code management (SCM) functionality of Git. GitHub extends this functionality with its own custom features such as access control, several collaboration features such as bug tracking, feature requests, task management, continuous integration, and wikis for every project.

Adding an Existing Project to GitHub using the Command Line

The instructions below assume that you have already installed Git on your system.

Follow these steps to add an existing project to Github.

Step 1: Create a new repository on GitHub.

Sign in to your GitHub account. Click on the plus (+) icon / New repository on the top right of the page and follow the on-screen instructions.

Step 2: Initialize the local directory as a Git repository

From within the local directory, in your terminal on Linux systems or cmd on windows type the following command.

$ git init

Step 3: Add the files to your new local repository. This stages them for the first commit.

$ git add .

or:

$ git add --all

Step 4: Commit the files that you’ve staged in your local repository.

$ git commit -m "initializd repo"

Step 5: Link your project with your GitHub repository.

Copy the remote repository URL field from your GitHub repository, which can be found under the Code tab.

In Terminal, add the URL for the remote repository where your local repository will be pushed.

$ git remote add origin [email protected]:<usernam>/<repository>.git

Note: Use the HTTPS URL version if you intend to use a username and password to push to the remote repository. To use public and private key pairs you may want to use the ssh version URL.

See also  Sphero's Star Wars BB-8 Droid

Step 6: Sets the new remote:

$ git remote -v

Step 7: Push the changes in your local repository to GitHub.

$ git push origin master

That’s it. you will now be able to use GitHub as source control for your existing project.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Share it!

Available under:
Articles, Guides, Technology, Tools