Git - Getting Started


An article that takes the basic steps in order to set up a Git repository


Repository Init

When you want to set up a repository, you face generally two options:

  1. you want to create a fresh install from a Git repository
  2. or you have already a project containing code files

Clone git repository

In this case, you just have to clone the repository.

git clone

Create a Git repository for an existing code base

  • Go to Github and create your repository
  • Go to your local map where your project file resides and init a new repository
cd myProjectMap
git init
  • Add the Github repository as a remote (The default one is generally called the origin)
git remote add origin
git remote -v # Verification of the URL
  • Pull the code in your local repository
git pull origin master
git status
  • Add them all to the next commit
git add -A
git commit -m "First Commit"
  • Push and set the default repo
git push --set-upstream origin master
Counting objects: 16, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (16/16), 10.06 KiB | 0 bytes/s, done.
Total 16 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
   82d4c6e..0822d6f  master -> master
Branch master set up to track remote branch master from origin.
  • Done

Powered by ComboStrap