In this workshop, participants will learn the basics of common Git commands used in various situations. This includes commands which help you examine repo history and state while also learning to manipulate repo history.
5
stars
0
forks
source link
Prerequisites - Before getting started, we want to make sure that everyone is ready to start #1
Now is a good time to create a shortcut to the command line application you will want to use with Git:
If you are working on Windows, we recommend Git Bash which is installed with the Git package, so that you can follow along with the facilitator who will be using Bash.
If you are working on macOS or another Unix-like system, you can use the built-in Terminal application.
If your clone is unsuccessful, read about authenticating with GitHub from Git. Please note: many corporate networks restrict SSH traffic, so we highly recommend using HTTPS and verifying the clone works before class. Also, if you have two-factor authentication enabled and wish to use HTTPS, you will need to set up a personal access token.
Step 4: Set Up Your Text Editor
For this class, we will use a basic text editor to interact with our code. Let's make sure you have one installed and ready to work from the command line.
Pick Your Editor
You can use almost any text editor, but we have the best success with the following:
If you do not already have a text editor installed, go ahead and download and install one of the above editors now! You can also configure Atom as your default text editor for Git commands using the instructions at docs.github.com.
Your Editor on the Command Line
After you have installed an editor, confirm you can open it from the command line.
If installed properly, the following command will open the Atom text editor:
atom .
Note: If you are working on a Mac, you will need to Install Shell Commands from the Atom menu, this happens as part of the installation process for Windows.
Setup
While you are waiting for class to begin, please take a few minutes to set up your local work environment.
Step 1: Set Up Your GitHub.com Account
For this class, we will use a public account on GitHub.com. We do this for a few reasons:
You can set up your free account by following these steps:
Trainees-Ascension-GH4D
team withwrite
permissionsIf you already have an account, verify that you can visit github.com within your organization's network.
GitHub is designed to run on the current versions of all major browsers. Take a look at our list of supported browsers.
Step 2: Install Git
Git is an open source version control application. You will need Git installed for this class.
You may already have Git installed so let's check! Open Terminal if you are on a Mac, or PowerShell if you are on a Windows machine, and type:
You should see something like this:
In general, we recommend you stay within two minor versions of the latest version of Git. The minor version is the second number in the series
x.x.x
.We suggest having version 2.29.2 or more recent if you're using Git for Windows or Git Bash.
Downloading and Installing Git
If you don't already have Git installed, you can download Git at www.git-scm.com.
If you need additional assistance installing Git, you can find more information in the ProGit chapter on installing Git.
Where is Your Shell?
Now is a good time to create a shortcut to the command line application you will want to use with Git:
Git Bash
which is installed with the Git package, so that you can follow along with the facilitator who will be using Bash.Step 3: Try cloning with HTTPS
Open your chosen shell, and type:
If the clone is successful you'll see:
If your clone is unsuccessful, read about authenticating with GitHub from Git. Please note: many corporate networks restrict SSH traffic, so we highly recommend using HTTPS and verifying the clone works before class. Also, if you have two-factor authentication enabled and wish to use HTTPS, you will need to set up a personal access token.
Step 4: Set Up Your Text Editor
For this class, we will use a basic text editor to interact with our code. Let's make sure you have one installed and ready to work from the command line.
Pick Your Editor
You can use almost any text editor, but we have the best success with the following:
If you do not already have a text editor installed, go ahead and download and install one of the above editors now! You can also configure Atom as your default text editor for Git commands using the instructions at docs.github.com.
Your Editor on the Command Line
After you have installed an editor, confirm you can open it from the command line.
If installed properly, the following command will open the Atom text editor:
Note: If you are working on a Mac, you will need to Install Shell Commands from the Atom menu, this happens as part of the installation process for Windows.