I am trying to push edits from within my pythonanywhere [hosting] account to the origin master at GitHub and fail.
It asks for my GitHub username and password. And it shows the following error, despite providing the correct credentials:
remote: Anonymous access to akhyansh13/simplifier.git denied.
fatal: Authentication failed for 'https://www.github.com/akhyansh13/simplifier.git/'
How do I push?
I would recommend setting up public key authentication.
Open a Bash console and then use:
ssh-keygen
To generate an ssh key. you can choose to add a passphrase if you want to encrypt it (later on, you can look into ssh-add and ssh-agent to do some "remember my passphrase" magic, but it's optional).
Then
cat ~/.ssh/id_rsa.pub
To print out your public key. Then go to github, open your account settings, and choose "add key", and copy and paste the public key above
Be aware that weird things happen sometimes when you copy + paste from pythonanywhere. Either paste it into a text editor first and remove any newlines and spaces, or, instead of using the public key from the bash shell, navigate to it using the "Files" tab.
Once you have those set up, you'll be able to use the git@
urls for your repos. To change an existing one, do:
git remote rm origin
git remote add origin git@github.com:akhyansh13/simplifier.git
Then, finally, you can
git push -u origin master
To push your commits up. The -u
sets the local master to be synced with origin/master.