[Git][Version Control] Git - Setup

Foreword

Setting up the environment of Git and some recommended GUI tools.

Install

  1. Install Git with the link below: (with your OS)
    Git official website

  2. Type this command to check if it is installed successfully:

    1
    git --version

Configure Git (type commands in your shell)

  1. Set your user name by running the following command:

    1
    git config --global user.name "Your Name"
  2. Set your email address by running the following command:

    1
    git config --global user.email youremail@example.com
  3. Set up SSH key (for remote repository access. e.g. GitHub)

    1
    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  • Press Enter to accept the default file location and passphrase (or set your own if desired).
    Once the key is generated, run the following command to add it to the SSH agent

    1
    ssh-add ~/.ssh/id_rsa
  • Copy the public key to your clipboard by running the following command

    1
    cat ~/.ssh/id_rsa.pub
  • Add the copied public key to your Git hosting platform account (e.g., GitHub, GitLab) by following their documentation.

  • View your ssh keys

    1
    cd ~/.ssh
    1
    ls
    • Use a text editor or command-line tools (such as cat or less) to view the contents of the .pub files and see the public key information:
      1
      cat id_rsa.pub
  1. You can see your configuration by typing the following commands:
    1
    git config --list

Recommended GUI tools

Both commands and GUI tools are important to Git manupulation.
And Here are some recommended Git GUI tools that you can use.