工具,  技术

How to create a new repo in github?

If you write codes only for your job and don’t really try to have your personal little projects you may never create a brand new project in repo even you have been written codes for years. So how to create a new repo in gitbut sounds easy but a lot of experienced developers may never do that.

Int he other hand, whether he/she can create a repo without any trouble or google search is a arguable way to determine whether he/she is a passionate developers or not (no argument needed here, personal option)..

Ok. let’s start.

  • Normally when you build a new repo you may use third part bootstrap tool to generate the template of the project. For example you may use spring initializr to do that: https://start.spring.io
  • Init your local git repo:
git init
git add .
git commit -m "initial commit"
  • Login into github and create a new repo. Please make sure you don’t do the initial commit since it would make it conflict with local copy. You want to start from your local template from scratch.
  • Since you have already created the repo locally, you just need to map it to the repo in github.
git remote add origin git@github.com:liangqiw/config.git
git branch -M master
git push -u origin master

Notes:

Technically you don’t need to have a remote repo you can just init the local git repo which may be good enough if you feel it’s just a test project you are working on. People easily forget this if they come from the old fashion version control tool like SVN..

  • Discard all local changes
    git reset; git checkout .;

Leave a Reply

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