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 add .
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’
Please let me know what I can do for the GitHub Push.
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
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.
- Do you have a github account setup?
- Did you setup an
ssh key for github? (guide to manually doing this is here)
- If you already had a pre-existing ssh key, did you add it to your github account? (guide to do this is here)
- What system are you on? (for further debugging, as steps can be slightly different depending on the platform)
- How much experience do you have with
git by itself? (not github)
- Have you tried to use the github-cli 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.