Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools GitHub Basics Working By Yourself Push Your Project to GitHub

Github password not working when pushing

Wondering if anyone else out there is having password problems when they attempt to push to Github. Here's the type of message I get when I enter my correct username & password:

remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/your_user_name/repo_name.git/'

From what I can find online, this is a common problem & may have something to do with Two Factor Authentication (2FA). However, I can not figure out how to fix it.

I created a brand new Github account just so I could follow along with this course.

Any insights would be appreciated.

3 Answers

I ran into this problem at the beginning of the year. For BEAU WITKA and anyone else having trouble with this:

>> Generating a Personal Access Token as password due to 2-Factor Authentication error in console

That can absolutely be caused if you have 2FA enabled; all you need to do is generate a Personal Access Token that you can use in place of your password. It should be stored (so that you don't have to enter it again every time), but you might want to write it down and keep it somewhere safe as a backup, e.g., if you lose your computer, need to reinstall your OS, etc. :thumbsup:

. .

Also - it wasn't in the question, but - this is something I ran into at the same time that is security/privacy related, as well:

>> Using your GitHub ID-based email address due to email privacy concerns

If you have your email address set to private, GitHub won't let you push a commit that reveals your email. In order to maintain privacy, you can use your ID-based GitHub email address (assuming the account was created after July 18, 2017) in place of your email address during the name/email configuration process. You can read more about setting your email on GitHub if that's something you're interested in doing. :lock: :white_check_mark:

Ari Misha
Ari Misha
19,323 Points

Hiya there! In order to use GitHub from your local Git bash, you might need to generate SSH keys in your local Git and just paste the the keys generated in Github Settings page.

Follow these steps to configure your Git bash

Try the following command for the crendential caching (only for Linux and windows)

git config --global credential.helper 'cache --timeout 3600'

where 3600 stands for the time to live for the cached credentials in seconds.

Generally, you can also overview all your cached assets by your Git Bash

git help credential-cache

I hope it helps!

~ Ari ~

Thanks for the suggestion Ari, I'll definitely give it a try.