Adding an existing project to GitHub using the command line

Step for existing project to GitHub using command line, following steps are required to this.

Step 1: Creating an account to the GitHub. Suppose
Username for GitHub: myGitUser
Password for GitHub: myGitPassword

Step 2: Access above url using mention username and password.

Step 3: Create New Repository to your account. To avoid errors, do not initialize the new repository with README. You can add these files after your project has been pushed to GitHub.

Suppose your repository name: myRepository

Step 4: Installing GitBash to you machine. for this link

Step 5: After installing GitBash open the command prompt for Git.


Step 6: In the Command prompt, change the current working directory to your local project.

Step 7: Initialize the local directory as a Git repository. As follows


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


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


Commits the tracked changes and prepares them to be pushed to a remote repository

Step 10: At the top of your GitHub repository’s Quick Setup page, click to copy the remote repository URL

Step 11: In the Command prompt, add the URL for the remote repository where your local repository will be pushed


# Sets the new remote

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


# Pushes the changes in your local repository up to the remote repository you specified as the origin