Key Tool Preparation (3) – Linux Remote Server
When you launch a new app, you may need to manage Git in the remote server connected to your GitHub account. As Linux OS is often used for servers, we'll explain how to set up the remote server environment.
As Git is usually pre-installed on Linux, the focus of this topic page is more on remote environment setup. If this topic is not relevant to your situation, skip this page.
Accessing the GitHub platform is still done through a web browser on your local computer; however, there are several options to access your remote server and utilize Git on your remote server.
On this page, we'll introduce three options using Linux OS installed on the AWS Lightsail instance.
- Option 1: Lightsail Browser-based SSH client
- Option 2: SSH Remote Login using Terminal (for Mac OS)
- Option 3: SSH Remote Login using VS Code
Option 1: Lightsail Browser-based SSH client
1. Set up an AWS Lightsail instance to launch a Linux server
If you don't have an AWS account, create it first. From the AWS console service menu, select Compute and go to Lightsail.
From the Lightsail console, we'll create a new instance using Ubuntu 22.04 LTS.
Select the cheapest option.
Change the instance name to GitHub-Practice and create an instance.
After a few minutes, the new instance will be created.
2. Check if Git is installed
Once the instance is created, click on the command line icon to launch a browser-based SSH client.
You can use it as a command line for Linux OS.
To check if Git is installed, run the command below.
git --version
If the command line returns a version information like shown below, Git is already installed on your computer. You can skip the following instructions.
git version 2.34.1
If Git is not installed or you want to upgrade it, follow the instructions below.
3. Update or install Git
A typical approach to install Git onto Linux computers is through the Linux command line.
Installation commands differ by Linux distributions. If you are using Debian/Ubuntu, you can use the apt-get
command.
sudo apt-get update
sudo apt-get install git
For other Linux distributions, please check this link Git download for Linux.
Option 2: SSH Remote Login using Terminal (for Mac OS)
If you are using Mac OS, you can access the AWS Lightsail instance using your Terminal. There are two approaches depending on how to generate SSH keys. Check the following topics under the Linux OS Introduction course to learn how to set up SSH remote login using Terminal.
SSH Remote Login (1) – Use Key Pair Generated by Server
SSH Remote Login (2) – Use Key Pair Generated by Client
Creating the SSH config file is also helpful to speed up the remote login process.
The approaches to check, update, or install Git are the same as the ones we explained in option 1.
Note: If you are using Windows, you can use PowerShell to access the AWS Lightsail instance. The approaches to set up the SSH remote login are the same as the ones using Terminal.
Option 3: SSH Remote Login using VS Code
You can also use VS Code for SSH remote login to access a remote server. There are VS Code extensions to support the remote login. Check the following topics under the Linux OS Introduction course to learn how to set up the SSH remote login using VS Code.
SSH Remote Login with Visual Studio Code
The approaches to checking, updating, or installing Git are the same as the ones we explained in option 1.
If you want to learn more about Linux OS, you can check the link below.