Introduction to GitHub (2023)

Introduction to GitHub (1)

In addition to being owned by Microsoft today, GitHub is the world's largest place for developers to sync, share, and collaborate on code. Big companies and solo superstars use GitHub, just like everyone else. If there is an open source project, it is probably hosted on GitHub.

But it's not only useful for people who write code. Anyone can pull code and files from a public GitHub repository, and there are unlimited projects you'll want to interact with at some point. From the biggest ones like Microsoft's Visual Studio Code orWindows package managerfor minors, such as using someone else's configuration files to design your terminal. If some kind of code is needed, it can be done via GitHub.

But while you don't need to know how to code to use GitHub, things can be a bit confusing for beginners. It doesn't have to be this way, so here are some of the basics you need to know.

Setting up a GitHub account

Introduction to GitHub (2)

You don't need a GitHub account to browse code and clone repositories, but it's worth signing up for. With just your own account and repository space, you can save your own files and fork other projects, follow other members, and bookmark repositories for easy access later. It is completely free and does not require a Microsoft account.

With a GitHub account, you can also use the often overlooked GitHub CLI terminal app, which you should have due to some changes to the way GitHub allows accounts to authenticate. More on that later.

You do notTerto interact with GitHub via the terminal, but in many cases it's the most efficient workflow. Instead, there's a GitHub desktop app for Windows, Mac, and Linux if you prefer something with a GUI. But for the purposes of this guide, we are going to focus on the terminal. It's not scary, I swear!

Install Git and GitHub CLI on your PC

Introduction to GitHub (3)

The main tool you'll use with GitHub is Git. This can be confusing, but Git is the tool and GitHub is the service that interacts with it. Git is completely separate and has nothing to do with Microsoft. The basic definition of Git is that it is a version control tool that allows multiple people to independently interact with the same files, with the option of merging changes into the master branch.

For now, we'll just cover the most important commands you need to know to start cloning GitHub repositories to your PC, but look for a more detailed guide on Git soon.

To install Git on Windows, just go toGit for Windows websiteand download the executable, or if you want to use the Windows Package Manager, open a new PowerShell window and type it

Winget instala git


On WSL distributions like Ubuntu and Debian, you can install Git with the command

sudo apt install git

. Simply.

Introduction to GitHub (4)

The GitHub CLI Tool is an official GitHub application and can wait for now if you don't plan on uploading anything to a GitHub repository yourself. If so, it's worth it as it avoids using Git's personal access tokens.

To install the GitHub CLI on Windows, you can use the Windows package manager again by typing

winget install github.cli

, or get it directly from GitHub. Alternatively, it's also available in the Scoop and Chocolately package managers, where you just need to install it.



On Linux and WSL, there are different methods depending on which distribution you use, butGitHub has full documentationyou can follow Mac users can also download the GitHub CLI application, either frompublished pageor via Homebrew, Conda, MacPorts and Spack where to find it



Clone your first repository from GitHub

Introduction to GitHub (5)

Cloning a GitHub repository is basically like syncing a folder to your PC from the cloud. The repository creates a new local folder and contains everything that was available in that repository. Typically, a GitHub repository is dedicated to a single project, so cloning will give you everything you need. If more dependencies are needed, there will almost always be one.


File with complete instructions.

Cloning the repository in terminal will create your local folder in the directory your command line is in at that point. So if you want to put it in a specific location, find the correct location in File Explorerthe right button of the mouseand open it in PowerShell/Windows Terminal. WSL distributions can also access the Windows file system. So if you're using Linux on your Windows box, the same idea applies. It is only stored in the Linux file system when you request it.

So, it's time to clone. For this example, we are going to clone the Microsoft Visual Studio Code repository.

Introduction to GitHub (6)

  1. Locate the desired repository on the GitHub website. For this example we use
  2. Click the button labeledCode.
  3. ChooseHTTPS.

Introduction to GitHub (7)

  1. Copy URL.
  2. Open the chosen terminal. Whether it's WSL, PowerShell, Mac, or Linux, the Git commands are the same.
  3. between non-terminalgit-Clone

There are other cloning options, including SSH and using the GitHub CLI client, but this is the easiest method, especially for beginners. It's also the method you'll find in most tutorials and many installation instructions you can find on GitHub.

Introduction to GitHub (8)

You have now downloaded everything from the Visual Studio Code repository to your PC. You can't make changes and push them back to GitHub (known as pushing) because you don't have the necessary permissions, but if you want to use or modify the code on your local machine, you can. To see the contents of the directory, you can type it


in the terminal and do a


or on windows you can type


to open File Explorer in that directory.

You now know the basics of using Git to clone GitHub repositories. The only ones you can't clone are private repositories you don't own, but anything else that's public is fair game. When you no longer need the files, simply delete them from your local computer. They do not affect the remote repository. If you want to get the latest files from this repository at any time, make sure you are in terminal in this directory and just type

pull git

to download the latest changes.

GitHub CLI authentication with your account credentials

Introduction to GitHub (9)

If you want to go a step further with GitHub and start uploading your own files, I recommend having the GitHub CLI app in your arsenal as well. It is a command line tool that coexists with Git and is specific to GitHub (Git itself can also interact with various services like GitLab and BitBucket).

GitHub no longer allows you to authenticate to Git with your account username and password, which requires a personal access token. The easiest way to authenticate your system is with the GitHub CLI, themay lUse your account username and password. To use it, open your terminal and follow these steps. Again, all the steps are the same whether you're using Windows, Mac, WSL, or Linux.

  1. between non-terminalgh authentication login
  3. ChooseHTTPSlike a record

Introduction to GitHub (10)

  1. untilYto authenticate with your GitHub credentials
  2. BeatGet intoto log in with a web browser.
  3. Type the one-time use code that is presented to you and pressGet into.

Introduction to GitHub (11)

  1. A browser will open, and you'll need to sign in to GitHub if you haven't already.
  2. Enter the unique code in the field.

You are now connected to the GitHub CLI client, and there are several things you can do with it, in addition to being able to push code with Git. To see the full list of commands, just type

g- help

not end device.

Setting up your first GitHub repository

There are two ways to easily set up your first GitHub repository. You can use the website or, now that you're connected to the GitHub CLI, create one with a few commands in a terminal.

This is what you need to do for both methods.

Introduction to GitHub (12)

Launch the GitHub home page and make sure you're signed in to your account. Follow the steps below to create a new repository.

  1. to tight+in the upper right corner.
  2. Choosenew deposit.
  3. Give your repository a name. This is required, whether public or private.
  4. Choosein publicoPrivatedepending on what you need.
  5. If necessary, select one of the optional files or licenses.
  6. cliquecreate deposit.

One of the files that it can generate automatically is a


Text file. You don't need any of these, but it's a good idea to have one, as it's the file that contains all your future information. Anything you write to this file will appear in your repository. If it's private and you're not going to share the content, it doesn't matter much.

You've now created your first GitHub repository! To sync it with your local PC, please follow the steps above to clone it.

Using the GitHub CLI

Introduction to GitHub (13)

Since most of your time using GitHub is spent in a terminal, the command line is a quick and easy place to start a new GitHub repository using the GitHub CLI. The added benefit here is that the repository is already linked to a local folder, configured, and ready for Git.

  1. Navigate to the local directory that you want to sync with a GitHub repository usingCDin terminal or by opening terminal in File Explorer.
  2. Get intostart gitand press Enter.
  3. Once the empty git repository is created, typeCreate gh repository.
  4. Give the repository a name (pressget intoto use the folder name).
  5. Give the repository an optional description and press Enter.
  6. Select the visibility for the repository withcursor keysand press Enter.
  7. untilYand press Enter to continue and create an Origin Git Remote.
  8. When it's done, you'll see a success message and confirmation of the remote you just created.

Introduction to GitHub (14)

The most important steps here are the first two because without them you can't create a repository using the GitHub CLI. All Git repositories should be initialized, and if you clone one from GitHub, it already contains the necessary files. The end result is the same, but with this method you can quickly create a GitHub repository and link it to your local/git repository folder, ready to commit and push.

Push to GitHub from the command line

Introduction to GitHub (15)

You now have your own GitHub repository. It's time to move some files there. Regardless of the method you used to create it, there are still a few steps you need to take after linking it to your local computer. The following steps assume that you have followed everything up to this point and have used the GitHub CLI to authenticate your system with your account.

First, you need to tell Git who you are. You can't push anything to GitHub without doing so first. Open a terminal and type these two commands.

git config --global "your username" git config --global "your email address"

Every time you push something from your PC to GitHub, that information is attached. In smaller cases, like personal repositories, this isn't as important, but the system is designed to accommodate large organizations as well.

Now we can push the content of our local Git repository to GitHub.

  1. Get intoadd git.on the end device. Since this is an initial push, we assume you want to send all the files. For individual files, replace period with the name of the file.
  2. Confirm that the files are being deployedgit status.

Introduction to GitHub (16)

  1. Now you have to confirm the files provided withgit commit -m "insert message here". The message is required, but for the first time"First use"it's good.

Introduction to GitHub (17)

  1. To press, typegit push --set-upstream Fuente maestraand press Enter.

Introduction to GitHub (18)

The length of the insert depends on the size of the directory, but once it's done you'll receive a confirmation and be sent back to a blank message. you can use

git status

always check if the mounted files need to be committed. Also note that step 4 is only required for the first commit. For future boosts, you can just use

git push

to push all committed files to the GitHub repository.

That may seem like a lot to do, but once you're set up to use GitHub and have spent some time using it both on the web and on your local machine, it quickly becomes second nature. Everything discussed here will get you fully set up and cover the basics needed to clone, push, and pull to and from GitHub.

Windows Central Newsletter

Get the best of Windows Central delivered to your inbox every day!

Introduction to GitHub (19)

ricardo devine

Editor-in-Chief: Technology, Reviews

Richard Devine is the editor-in-chief of Windows Central with over a decade of experience. A former project manager and longtime tech junkie, he joined Mobile Nations in 2011 and has been found on Android Central and iMore, as well as Windows Central. He is currently responsible for the site's coverage of all types of hardware and PC reviews. Find it on Mastodon

Top Articles
Latest Posts
Article information

Author: Prof. An Powlowski

Last Updated: 02/23/2023

Views: 6057

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Prof. An Powlowski

Birthday: 1992-09-29

Address: Apt. 994 8891 Orval Hill, Brittnyburgh, AZ 41023-0398

Phone: +26417467956738

Job: District Marketing Strategist

Hobby: Embroidery, Bodybuilding, Motor sports, Amateur radio, Wood carving, Whittling, Air sports

Introduction: My name is Prof. An Powlowski, I am a charming, helpful, attractive, good, graceful, thoughtful, vast person who loves writing and wants to share my knowledge and understanding with you.