How to avoid a 403 Forbidden error when cloning a private repository

Sometimes when I’m trying to clone a private repository to a remote host, I get a 403 Forbidden error, like so:

git clone

Initialized empty Git repository in /home/public_html/.git/
error: The requested URL returned error: 403 Forbidden while accessing

fatal: HTTP request failed

No prompt for a username and password, just the door unceremoniously slammed in my face. Rude.

The solution is to follow proper http authentication formatting and include a username, like so:

git clone https://[username]

Think of it like introducing yourself before asking for something. Your mother was right: Manners count.

Already cloned your repository? You can always associate a username after.