-
Notifications
You must be signed in to change notification settings - Fork 0
1. Installing everything from scratch
Linux is a family of open-source operating systems that enables more flexibility in installing/downloading software, managing file systems, and running computational processes (ie Git). This tutorial goes over a step-by-step procedure on how to download Ubuntu 18.04 and run it on a Windows 10 machine.
Microsoft has a very straightforward guide to installing Linux on Windows. However, I will describe the steps and emphasize certain points in this tutorial to streamline the installation process.
Note that there are several flavors of Linux. Once you have finished restarting your computer, you will need to choose one distribution to install. For this tutorial, we'll download Ubuntu 18.04, which is a relatively beginner-friendly Linux OS to start with.
-
Search for the
PowerShell
command prompt. Before clicking on the app, right-click the app and choose to run as an Administrator. -
In the window, copy and paste the following command. It will prompt you to restart your computer to finish the installation:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
- Search for the
Command prompt
application. Right-click and choose "run as an Administrator", and download the.appx
file containing the Ubuntu OS using curl:
curl.exe -L -o ubuntu-1804.appx https://aka.ms/wsl-ubuntu-1804
- The file should be downloaded in your current working directory. To finish the installation, you can type the following command into
PowerShell
:
Add-AppxPackage .\ubuntu-1804.appx
-
Once you have finished your installation, search for the Ubuntu app and open it. You will be prompted to create a new user account and password.
-
You should have the bare minimum Linux OS installed! Now we will update the package catalog and upgrade the installed packages after this initial install. To do this, type in the following to your Ubuntu terminal and follow the subsequent prompts:
# Get information for packages that can be upgraded
sudo apt-get update
# Upgrade packages
sudo apt-get upgrade
# Remove useless packages
sudo apt autoclean; sudo apt autoremove
Now that you have updated your Ubuntu OS, you're ready to start using bash commands in your Windows machine. If you're not familiar with Linux commands, there is a tutorial that goes over basic Linux commands for navigating through your computer's filesystem.
The macOS and Linux kernels are very similar, and so some Linux commands will work on the macOS Terminal
. However, before using Git, I would recommend installing Homebrew, a package manager that is similar to the Debian apt package manager. The only step you need to download Homebrew is the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
To learn more about homebrew, you can read the documentation and play around with other brews.
- You can copy-and-paste the following command into the Ubuntu terminal to install Git via the command line:
# Get information for packages that can be upgraded
sudo apt-get update
# Upgrade packages
sudo apt-get upgrade
# Remove useless packages
sudo apt autoclean; sudo apt autoremove
# Finally, install git
sudo apt-get install git-all
This should install all the essential packages for using Git.
- Now that we have Git running on our system, we can customize some of our settings that will allow us to use Git with GitHub. First, we will set the user name and email address. Input the relevant information for your user name and email address (emphasized with "<>" symbols):
git config --global user.name "<Your Name>"
git config --global user.email "<youremail@email.com>"
Next, we will set the text editor that will be used when writing messages in Git. The easiest and most intuitive one to get started with is nano
, but you can feel free to use other popular ones such as vim
or emacs
if you're comfortable with those editors. I will be writing this tutorial using nano
as the editor.
- To set the text editor as
nano
(or any other text editor), type in the following:
git config --global core.editor nano
- This was a brief intro to some of the parameters you can input for your Git setup. To see other configuration files that you can change, including text colors, type in:
git config --list
- There will be some commands that you use fairly frequently, but will not know all the parameters for. To find out more about a specific git command, you can type in the
-h
or--help
arguments following any command. For example:
git add --help
will return
usage: git add [<options>] [--] <pathspec>...
-n, --dry-run dry run
-v, --verbose be verbose
-i, --interactive interactive picking
-p, --patch select hunks interactively
-e, --edit edit current diff and apply
-f, --force allow adding otherwise ignored files
-u, --update update tracked files
--renormalize renormalize EOL of tracked files (implies -u)
-N, --intent-to-add record only the fact that the path will be added later
-A, --all add changes from all tracked and untracked files
--ignore-removal ignore paths removed in the working tree (same as --no-all)
--refresh don't add, only refresh the index
--ignore-errors just skip files which cannot be added because of errors
--ignore-missing check if - even missing - files are ignored in dry run
--chmod (+|-)x override the executable bit of the listed files
Congrats! We've gone over how to install Linux to our machine, and how to install Git as well as simple Git usage. Next, we'll go over how to start using Git and GitHub together for tracking specific projects or repositories.
- Atom is a free open-source and hackable IDE that has a very active developer community, and contains several packages that can help your Git experience. The only downside to Atom is that it is slower compared to other IDEs.
- StackEdit is an open-source, Google Chrome application that allows you to write Markdown files in a single platform and can integrate with GitHub, Google Drive, and other applications.
- Most of the introduction to Git was summarized from this page
- Super useful step-by-step guide to installing Linux onto Windows
- Useful commands for the Linux terminal. For some suggested reading, see the Linux resources page
Contributions are welcome! To contribute to this guide, please submit a pull request with a detailed description of:
- Which specific section you added or changed
- What you specifically added
- How does your contribution this make the tutorial better
Happy gitting!