Saturday, 18 October 2014

Adding an Existing Project from Local Machine to Github using Commands

In this post I will describe to upload an existing project from local machine to Github.

The steps are as following:

Step-1. Create a new repository on GitHub. Do not initialize the new repository with a README file.

Step-2. In Terminal, change the current working directory to your local project.

Step-3. Initialize the local directory as a Git repository.
            
             $ git init
Step-4. Add the files in your new local repository. This stages them for the first commit.
             $ git add .
Step-5. Commit the files that you've staged in your local repository.
             $ git commit -m ‘First Commit’
Step-6. In your GitHub repository, in the right sidebar, copy the remote repository URL.
Step-7. In Terminal, add the URL for the remote repository where your local repostory will be pushed. 
            $ git remote add origin <remote repository URL>
Step-8. Verifies the new remote URL
            $ git remote -v
Step-9. Push the changes in your local repository to GitHub.
            $ git push origin master
Now your local project should be available on github repository.

I hope you would have liked the post.
Thanks

No comments:

Post a Comment