GIT Tutorial: How to Push to a New Repository


Set up your global git configuration first.

git config --global user.name "Your Name"
git config --global user.email "id@your.site"
  • If you want to create a new repository:
git clone ssh://id@your.site/some-repo.git
cd some-repo
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
  • Or just push the existing folder into repository:
cd existing_folder
git init
git remote add origin ssh://id@your.site/some-repo.git
git add .
git commit -m "Initial commit"
git push -u origin master
  • Or maybe push existing Git repository:
cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://id@your.site/some-repo.git
git push -u origin --all
git push -u origin --tags

That’s it! It is simple but it helps a lot.


Leave a Reply

Your email address will not be published. Required fields are marked *