Last Updated: December 26, 2018
·
4.677K
· artchang

Push new project to Github

Introduction

This is a quick explanation of how to get a project you're working on locally, onto a remote hosted Github repository that doesn't exist yet.

This is a simple task, yet I never do it enough to remember exactly the right steps to take. So here's a quick overview.

Steps

  1. Create a new project locally, for example a Sinatra app.
  2. git init in order to initialize your directory
  3. touch README.md so that Github can display some text, make it useful.
  4. git add all the files you want to include
  5. git commit -m "your commit message"
  6. Create a repository in your Github account on https://github.com
  7. git remote add origin git@github.com:username/repo-name.git This will set your remote repository for you. Use your github username and the repo-name is what you created on the web.
  8. git push -u origin master will then get your repository finally pushed to the remote (set as origin). The -u is for credentials into your github repository.

2 Responses
Add your response

First thing anyone going to work with Git should know. Useful tip!

over 1 year ago ·

Thanks for the tip, not to mention you should probably add a .gitignore file and ignore critical files.

over 1 year ago ·