Saturday, January 24, 2015

Adding already existing project to GitHub using command line

A typical problem that I often have, playing with various repositories and frameworks is how to add already existing project to a remote repository. In this tutorial I show how to do it for a GitHub mostly by using a command line. I assume that git environment is already set up and that there is already a working environment that is able to push/pull data from GitHub. For windows the only thing that one has to do is to install GitHub for windows.
  • 1. Create a new repository in GitHub - it means go to GitHub page, login, add a new repository. This is the only step that requires doing something not in a command line. I will create a my-app repository, so it will be available under https://github.com/sagasu/my-app
  • 2. Open a git shell.
  • 3. Navigate to a project directory. Actually you have to 'cd my-app', and be in a directory with a project files.
  • 4. git init
  • 5. git add .
  • 6. git commit -m 'message'
  • 7. git remote add my-app https://github.com/sagasu/my-app
  • 8. git push -u my-app master

No comments: