Loading...

Push existing code to remote git repository

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

For the situation you have created a remote (master) repository on GitHub, BitBucket or OpenHub.

cd existing-project
git init
git add --all
git commit -m "Initial Commit"
git remote add origin https://github.com/user/project.git
git push origin master

Steps explained:

  • Change to source directory
  • Initialize git repository
  • Add and commit the changes (ignore unwanted files with .gitignore)
  • Add remote repository, replace user and project with your data
  • Push to repository with branch master, you may have to authenticate yourself at the server or ssh-key
git
Please remember the terms for blog comments.