Ubuntu Can Log Into Google but Not GitHub? Fixes Here

So, you’ve fired up your Ubuntu machine, enthusiastic to push some code to GitHub. You try to log in—but bam! No dice. GitHub keeps refusing while Google lets you waltz right in. What gives?

Let’s break this mystery down and help you fix it with easy steps.

TL;DR

If your Ubuntu machine logs into Google just fine but throws a fit when you try GitHub, it’s likely related to authentication settings, SSH keys, or internet restrictions. You may need to update your Git client, check your SSH setup, or tweak some GitHub settings. It’s fixable, we promise. Keep reading!

1. First, Let’s Understand the Problem

Google uses standard browser-based login. GitHub has several ways to verify who you are. It can ask for:

  • Username and password (not recommended anymore)
  • Personal Access Tokens (PATs)
  • SSH keys
  • GPG signatures (for commits)

So, just because you can log into Google doesn’t mean everything’s rosy. GitHub plays by different rules.

2. Are You Even Using the Right Login Method?

GitHub no longer accepts passwords in terminal-based Git operations. If you try:

git push origin main
Username: yourusername
Password: yourpassword

It won’t work. You’ll just get authentication errors.

Here’s what you should do:

  • Get a Personal Access Token from GitHub
  • Use it instead of your password when Git prompts you

To create a token, go to your GitHub account:

  1. Click your profile pic > Settings
  2. Go to Developer settings > Personal access tokens
  3. Click Generate new token
  4. Choose scopes like repo or whatever you need
  5. Copy it—you won’t see it again!

Then use that token as your password. Done!

3. Or Maybe You’re Supposed to Use SSH?

If your GitHub URL looks something like this:

git@github.com:yourusername/yourrepo.git

you’re using SSH, not HTTPS. That’s a completely different setup.

You’ll need to make sure you’ve added your SSH key to GitHub. Here’s how:

Step-by-step:

  1. Check if you already have a key:
    ls ~/.ssh/id_rsa.pub

    If it exists, cool.

  2. If not, create one:
    ssh-keygen -t ed25519 -C "your_email@example.com"

    Press enter a few times.

  3. Now, copy the key:
    cat ~/.ssh/id_ed25519.pub
  4. Go to GitHub → SettingsSSH and GPG keys
  5. Click New SSH Key & paste it in

Also, make sure your SSH agent is running and your key is loaded:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

Done and done!

4. But What If Nothing Works?

Still locked out? Try the nuclear options. These are common hiccups:

  • Your system clock is out of sync

    GitHub is picky about time. Use this command:

    sudo timedatectl set-ntp true
  • Your Git is outdated

    Old Git versions can’t handle tokens and new security protocols:

    sudo add-apt-repository ppa:git-core/ppa
    sudo apt update
    sudo apt install git
  • Your firewall or proxy is blocking traffic

    Some office networks love to be annoying. Try switching to HTTPS or using a VPN.

5. You Can Also Use a Git GUI!

If the terminal gives you a headache, try a Git GUI like:

  • GitKraken
  • GitHub Desktop (works with some effort on Ubuntu)
  • SmartGit

These usually include their own authentication flow and might bypass some of the token/SSH issues. Nice, right?

6. Check Your Remote URLs

Sometimes it’s as silly as having the wrong URL. Check like this:

git remote -v

If it shows HTTPS but you’re trying SSH, or vice versa, things might break. To switch:

# To switch to SSH:
git remote set-url origin git@github.com:yourusername/yourrepo.git

# To switch to HTTPS:
git remote set-url origin https://github.com/yourusername/yourrepo.git

Be consistent!

7. Bonus: Use Credential Helpers

Ubuntu can store your GitHub token so you don’t need to enter it again and again.

Use Git’s built-in credential store:

git config --global credential.helper cache
# or, for longer-term storage:
git config --global credential.helper store

If you use GNOME, you can go next level:

sudo apt install libsecret-1-0 libsecret-1-dev
cd /usr/share/doc/git/contrib/credential/libsecret
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret

Now credentials get stored in your login keyring. Safe and secure!

8. For GitHubbing With Style

Once you’re in, give your Git some flair!

  • Set up your name:
    git config --global user.name "Your Name"
  • Set your email:
    git config --global user.email "you@example.com"
  • Check it’s all good:
    git config --global --list

Let’s Wrap This Up

If your Ubuntu machine logs into Google but not GitHub, that’s not a bug—it’s just GitHub being a little more secure and complex.

Most of the time, you just need to:

  • Stop using passwords
  • Use a token or SSH key
  • Make sure Git is up to date
  • Tame your firewalls or proxies

With a little setup, your Ubuntu box will push, pull, and clone like a champ.

Good Luck and Happy Coding!

Go make something awesome. And now, GitHub knows you’re legit.

I'm Ava Taylor, a freelance web designer and blogger. Discussing web design trends, CSS tricks, and front-end development is my passion.
Back To Top