Pushing to GitHub Using Linux

2/12/2025 12:00:00 AM

joe-jngigi

This article is a short one, basically explaining how we can push code to GitHub using Linux.

When I recently moved from Windows to Linux for my personal projects, the biggest bummer was figuring out how to push my code to GitHub—because, seriously, what the heck? It felt like a hassle.

Every time I tried to push my code, Git prompted me to enter my GitHub credentials, which became frustrating. So, I did some research and found a way to avoid this.

git push origin next

Background

To push code without repeatedly entering credentials, we use Git Credential Manager (GCM). It's a secure Git credential helper that provides a seamless authentication experience, including multi-factor authentication, across different platforms and services.

Git sometimes requires authentication when accessing remote repositories like GitHub over HTTP.

Installation and Setup

For Linux, specifically Debian-based distributions, follow these steps:

1. Download and Install Git Credential Manager

Download the package from the official GitHub Debian Package page and install it.

2. Configure Git to Store Credentials

Run the following command to enable credential storage:

git config --global credential.helper store

3. Authenticate with GitHub

Run this command to prompt a sign-in via your browser or VS Code. GPT says the first one might not work, but it worked for me. You can ran either.

git config --global credential.credentialStore cache
git config --global credential.helper cache

After authentication, Git will securely store your credentials, and you won't need to enter them again when pushing code.


This setup should make pushing to GitHub much smoother in the future. 🚀