Skip to content

Details

Git introduction - an on hands approach

  1. What is Git?
  2. Why use it?
  3. What is so cool about git compared to other tools
  4. Various ways to setup git
  5. On hands
  • pre requisits
  • creating a repository in your own account
  • clone it locally to your laptop
  • staging, viewing and committing snapshots
  • undoing changes
  • basic commiting
  • branching & pull request

Set up instructions to be able to dive into the hands on part -

  1. Install git
    OSX:
    a. xcode-select --install
    b. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    brew install git

Linux:
a. For Redhat/CentOS: yum install git
b. For Debian/Ubuntu: apt-get install git

Windows:
a. https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/Git-2.21.0-64-bit.exe

Use the "Git Bash" program instead of "Command Prompt"

git config --global core.editor '"C:/Program Files (x86)/Notepad++/notepad++.exe"'

  1. Verify Installation
    git --version

Output:

git version 2.20.1 (Apple Git-117)

Run the following:
git config --global user.name "Firstname Lastname"
git config --global user.email "Email ID"

To verify, run:
git config --list

Output:

user.name=John Doe
user.email=John.Doe@Domain.com

  1. Install gogs (local git server, I am assuming not everyone will have git enterprise)

a. Install docker (I assume this is already done as there was a docker meetup before)

b. Save the contents between the lines below to this file: ~/Downloads/docker-compose-gogs.yaml:

gogs:
restart: unless-stopped
image: gogs/gogs
volumes:

  • ~/Downloads/gogs:/data
    ports:
  • "2222:22"
  • "3000:3000"
    -------------------------------
    To verify installation, run:
    docker-compose -f ~/Downloads/docker-compose-gogs.yaml up

To Stop gogs, run:
docker-compose -f ~/Downloads/docker-compose-gogs.yaml down

Next steps will be done during meetup.

  1. Create SSH keypair to interact with git

Your existing keys will be overwritten. Before proceeding, check for existing keys as follows:

ls -al ~/.ssh/

if you see these two files, you already have a key pair:
-rw------- 1 user group 1679 Aug 18 2016 id_rsa
-rw-r--r-- 1 user group 405 Aug 18 2016 id_rsa.pub

Make sure "id_rsa" has 600 permission.

If not, follow instraction from here:
https://help.github.com/en/enterprise/2.16/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Presenter: Mr. Debasis Aich, Data Engineer at Target

Members are also interested in