Git - Getting Started

About

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

Steps

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 https://github.com/gerardnico/myRepo.git

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 https://github.com/gerardnico/myRepo.git
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.
To https://github.com/gerardnico/myRepo.git
   82d4c6e..0822d6f  master -> master
Branch master set up to track remote branch master from origin.

  • Done





Discover More
Git

is a content-addressable file system used to track directory tree content (as defined by its creator Linux Torvald) It's not a version control...
What is the Git Repository (Directory) ?

This page is the notion of repository and how it's implemented in Git. The git repository is a subdirectory named .git called also GIT_DIR that contains all repository files. It contains : commit...



Share this page:
Follow us:
Task Runner