[Notes] Git How to Step by Step: windows

Posted by jerryeml on 2021-03-10

Git installation

    • Download git installer from https://git-scm.com/download/win and install.....
    • Choose Use Git From Git Bash only if you want to use the Git command line tools from Git Bash
      or choose Use Git from the Windows Command Prompt if you want to use the Windows Command Prompt
    • using choco command
    • choco install git.install -y

Git setup

  1. Open Git Bash
  2. The first thing you should do when you install Git is to set your user name and email address.
    This is important because every Git commit uses this information, and it’s immutably baked into the commits you start creating:
    git config --global user.name "Jerry He"
    git config --global user.email jerry_he@email.com
  3. Check setting with following command
    git config --list

Git Clone from git repository

  1. Go to Github page and find the repo you want to clone
  2. click Clone and download button and copy the git URL (choose SSH to clone to repo)
  3. Generating a new SSH key and adding it to the ssh-agent (https://help.github.com/en/enterprise/2.15/user/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
  4. Adding a new SSH key to your GitHub account (https://help.github.com/en/enterprise/2.15/user/articles/adding-a-new-ssh-key-to-your-github-account)
ssh-keygen -t rsa -b 4096 -C "jerry_he@trendmicro.com"

eval $(ssh-agent -s)

ssh-add ~/.ssh/id_rsa

clip < ~/.ssh/id_rsa.pub

  1. Change directory to ApexOne_Auto and check remote repo should set github as "origin" for push and fetch

Create branch for development

  1. create a JIRA case for the devlopment and use that JIRA case number to create a new branch. The following demo will take SEG-9999 as an example.
  2. create branch git checkout SEG-9999
  3. set push back the dev branch back to GitHub git push --set-upstream origin SEG-9999
  4. ready to work!

#Git #Basic

Related Posts

D57_W7 作業們影片檢討

D57_W7 作業們影片檢討

智能合約(三) - IDE 開發環境

智能合約(三) - IDE 開發環境