Add a project To GitHub

Here we look at how to add a project to GitHub. There are two ways to do this. The easy way is to create a project in GitHub and clone it to your desktop. The hard(er) way is to use the command-line from within an existing project.

# Using the command-line

Essentially you need to create a blankk project on GitHub and use the repository url to push your local project. First you have to add a remote to your local copy - github

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

git remote add origin remote repository URL # Sets the new remote git remote -v # Verifies the new remote URL

Push the changes in your local repository to GitHub.

git push -u origin master # Pushes the changes in your local repository up to the remote repository you specified as the origin

GitHub gives you the command-line commands you need (just copy and paste) when you create a new repository. For instance after creating a new project "lcw_Tools":

echo "# lcw_Tools" >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/opn/lcw_Tools.git git push -u origin master