Git - Getting Started

> Code - (Programming|Computer) Language > Code Versioning > Git

1 - About

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

Advertising

3 - Steps

3.1 - 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

3.1.1 - Clone git repository

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

git clone https://github.com/gerardnico/myRepo.git

3.1.2 - 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
Advertising
code/version/git/getting_started.txt · Last modified: 2017/09/26 10:28 by gerardnico