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.
- Go into the directory containing the project - using bash (not the Windows prompt).
- Run git init.
- 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.
- Run git add . to add all of the relevant files.
- Run git commit.
- Go to your git repository directory.
- Type git init --bare project-name.git.
- Go to the project directory.
- 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
- Type git push -u origin master