Install Git on Ubuntu, set your name and email, and connect Git to a GitHub account. You will create an SSH key, add it to GitHub, and push a first repository. It suits beginners on Ubuntu who want version control for their code.
YouTube video: How to Install and Configure Git and GitHub on Ubuntu (Linux)
Caption availability is unknown. Check the CC control in the YouTube player.
- Video length
- 18 min 29 s
- Time to do it
- 20 minutes
- Difficulty
- Easy
- Steps
- 8
What you need
Steps
Open a terminal and run sudo apt update, then sudo apt install git. Enter your password when asked and confirm with Y. Check the install with git --version.
Set your identity so commits carry your name. Run git config --global user.name "Your Name" and git config --global user.email "[email protected]".
Create a free account at github.com if you do not have one, then log in.
Generate an SSH key in the terminal with ssh-keygen -t ed25519 -C "[email protected]". Press Enter to accept the default file path and set a passphrase if you want.
Copy the public key with cat ~/.ssh/id_ed25519.pub. In GitHub, open Settings, then SSH and GPG keys, click New SSH key, paste the key and save.
Test the connection with ssh -T [email protected]. Type yes when asked to trust the host. A greeting with your username means it works.
Create a new repository on GitHub, then copy its SSH address. In your project folder run git init, git add. and git commit -m "first commit".
Link the folder to GitHub with git remote add origin [email protected]:user/repo.git, then push with git push -u origin main.
Tips and common mistakes
If GitHub rejects your password on push, use a personal access token or the SSH address instead of HTTPS.
Run git config --list to check your name and email are set correctly.
Keep your private key file secret and never paste it into a website or chat.
Commit small changes often with clear messages so history stays readable.
Questions
Do I need SSH keys, or can I use HTTPS?
HTTPS works too, but GitHub no longer accepts account passwords for pushes. With HTTPS you must create a personal access token and use it as the password.
Where do I run these commands?
In the terminal on your Ubuntu machine, inside the folder that holds your project files.
How do I check Git is installed?
Run git --version. If it prints a version number, Git is ready to use.
The notes are drafted automatically from video details and general task knowledge. How the guide was prepared
Report a correction


