# GitHub Error: Authentication Failed

**URL:** <https://forum.freecodecamp.org/t/github-error-authentication-failed/519555>\
**Category:** General\
**Created:** [June 19, 2022, 5:23am UTC](https://forum.freecodecamp.org/t/github-error-authentication-failed/519555 "2022-06-19T05:23:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aimslee](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/aimslee/32/134621_2.png) [@Aimslee](https://forum.freecodecamp.org/u/Aimslee)\
**Post date:** [June 19, 2022, 5:23am UTC](https://forum.freecodecamp.org/t/github-error-authentication-failed/519555/1 "2022-06-19T05:23:40Z")

</div>

Hi,

I’m working with a simple HTML file and trying to make a first commit.

I created a new repository in GitHub and on CMD, I typed:

git init  
git add .  
git status  
git commit -m “First Commit”  
git remote add origin (pasted the url from the repository)  
git push -u origin master  
(Then, I’m asked to type in my Username and Password)

Here, I fill in my Username and paste in my personal token from GitHub website. It’s because I have had trouble with the Username and the Password and heard that the personal token would help.

However, I’m still having trouble. I still get

fatal: Authentication failed for ‘[aimslee/simpleshape · GitHub](http://github.com/aimslee/simpleshape.git/)’

Please let me know what I can do for the GitHub Push.

Amy

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 19, 2022, 1:15pm UTC](https://forum.freecodecamp.org/t/github-error-authentication-failed/519555/2 "2022-06-19T13:15:00Z")

</div>

if it asks username and password, you need to write those - if you want to use personal token you need to set it up in a different workflow

---

<div class="post-metadata">

**Author:** ![bradtaniguchi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bradtaniguchi/32/110427_2.png) [@bradtaniguchi](https://forum.freecodecamp.org/u/bradtaniguchi)\
**Post date:** [June 19, 2022, 7:33pm UTC](https://forum.freecodecamp.org/t/github-error-authentication-failed/519555/3 "2022-06-19T19:33:29Z")

</div>

Authentication errors can be hard to debug, however there are a number of ways to “work around” it if your repo is just starting out.

However, before going over some ways to “get started” with git+github, I’d like to go over some high level checks first.

1. Do you have a github account setup?
2. Did you setup an `ssh` key for github? (guide to manually doing this is [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent))
3. If you already had a pre-existing ssh key, did you add it to your github account? (guide to do this is [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account))
4. What system are you on? (for further debugging, as steps can be slightly different depending on the platform)
5. How much experience do you have with `git` by itself? (not github)
6. Have you tried to use the [github-cli](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) instead?

- I personally used to use the above manual steps to setup the machine I plan on using, however with the release of the github-cli, I usually install that, and let it setup my ssh keys to my account. It just does the same “manual steps” for you, with sensible defaults and less complexity.

* * *

With those checks, odds are your `ssh` key might not be setup properly, which means you’ll probably have to re-generate/re-upload it again to your profile. (see above guides on details for each of those steps).

Alternatively you could install the github-cli and let it walk your system through setting it up.

I see your github repo exists, but is empty. This should make things easy, as it provides information on how to get things deployed to the repo, leaving just any related `ssh` key issues.

**note** github used to support non-ssh setup, but I’m not sure if this supported anymore, last I checked it was deprecated/being removed? I’d highly suggest always using `ssh` based authentication methods over any other method (like username and password). Its more secure, less error prone, and integrates with all systems pretty well.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [December 19, 2022, 7:33am UTC](https://forum.freecodecamp.org/t/github-error-authentication-failed/519555/4 "2022-12-19T07:33:44Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
