Adding an existing project to a Git repo

Just a quick tip for creating a new repo with existing files.

  1. Create a new repo on your preferred solution (I use Bitbucket but the other main choice is Github, it’s all about what works for you)

  2. Change to your project directory > cd ~/git/project

  3. Initialize the local directory as a repo > git init

  4. Add all files to the repo > git add .

  5. Write your first commit message > git commit -m ‘First commit’

  6. Tie your local files and remote repo together. For the url, an example would be ssh://, but the method to find it varies depending on your provider. Bitbucket shows it at the top of the main page and GitHub shows it along the right side. > git remote add origin repo_url_here

  7. Have git verify it can connect to the remote repo > git remote -v

  8. Push your initial commit to the remote url > git push origin master

Thats it, your repo is created and initial update complete. Now to continue your content and update it as needed.

comments powered by Disqus