Create a git project from existing sources

So you've created a new project and it looks pretty good, and you'd like to add it to your Git repository. Here's the step-by-step guide as to how to do this.

This assumes that your existing project is on a Windows PC.

  1. Go into the directory containing the project - using bash (not the Windows prompt).
  2. Run git init.
  3. You'll probably want to create a .gitignore file right away, to indicate all of the files you don't want to track. See github for lots of examples.
  4. Run git add . to add all of the relevant files.
  5. Run git commit.
  6. Go to your git repository directory.
  7. Type git init --bare project-name.git.
  8. Go to the project directory.
  9. Run git remote add origin path-to-git-repo,

    where path-to-git-repo is...

    • repository on the same Window PC - C:\\Users\\your-name\\Documents\\GIT-REPOS\\project-name.git
    • repository on a remote Linux/Mac box - ssh://user@host:/path/to/git-repo/project-name.git
  10. Type git push -u origin master
Reference: Karl Broman's github tutorial on Start a new git repository.