Start a New git Repository

Start a New git Repository

It's your first instinct. When you start to do something new with git, should be follow some step, like git init .

A new repo from scratch

You have just got some data from a collaborator and are about to start expolring it.

1.  create a directory to contain the project.

2.  go into the new directory

3.  type git init

4.  write some code

5.  type git add to add the files

6.  type git commit -m "your message"

The 1st file to create is propably a README file, either as plain text or something else like markdown.

A new repo from an existing project

You have got an existing project that you want to start tracking with git.

1. go into directory containing the project.

2. type git init

3. type git add . to add all of the relevant files

4. you will propably want to create a .gitignore file right away, to indicate away, to indicate all of the files you don't want to track. use git add .gitignore, for this.

5. type git commit -m "your message"

Connect it to github/bitbucket or else

You have now local git repository. You can use git locally, like that if you want. but if you want the thing to have a home on github/bitbucket, do the following. Here i describe for github

1. go to github.

2. log in to your account

3. click the new repository button in the top-right You'll have an option there to initialize the repository with README file.

4. Click the create repository

Now follow the 2nd step 'push an existing repository'

git remote add origin git@github.com:username/new_repo

git push -u origin master

 

Common Steps

git init

git add .

git commit -m "your message"

git pull origin master

git push -u origin master

Thanks for read. If you face any problem or if you have any advice for me, please leave a message at https://facebook.com/picchinobita