Sometimes when I’m trying to clone a private repository to a remote host, I get a 403 Forbidden error, like so:
git clone https://github.com/repos_username/repos_name.git
Initialized empty Git repository in /home/public_html/.git/
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/repos_username/repos_name.git/info/refs
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]@github.com/repos_username/repos_name.git
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.