sdaau
sdaau

Reputation: 38619

How to push to own github gist with password, without TFA?

So, I've tried setting up a gist under my own username on github:

... and I'm trying to clone, edit and push to this gist. I do not have 2-factor authentication (2FA) enabled in Your Profile/Edit Profile/Security (github.com/settings/security).

I would like to clone this repo, so when I push, I authenticate with my GitHub password, and not with a personal access token; and also I would like to avoid creating public keys for SSH access.

This is what I can observe so far:

cd /tmp/
$ git clone https://[email protected]/771e0ca9b9f1fa17464373266400386f.git yet_another_git_tute_gist
Cloning into 'yet_another_git_tute_gist'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.

So, when cloning, even if I have my username specified in the HTTPS url, I'm not being asked for a password, the repository just gets cloned. This is an example of changes before push:

cd yet_another_git_tute_gist/

git config user.name sdaau
git config user.email sdaau@whatever

echo >> README.md  # just add empty line
git add README.md
git commit -m 'testing'
# [master 0f958d5] testing
# 1 file changed, 1 insertion(+)

... and this is the push:

$ git push --all
Password for 'https://[email protected]': 
remote: Invalid username or password.
fatal: Authentication failed for 'https://[email protected]/771e0ca9b9f1fa17464373266400386f.git/'

Would anyone know what am I doing wrong?

Upvotes: 2

Views: 1445

Answers (1)

sdaau
sdaau

Reputation: 38619

Oh well, after half an hour of re-cloning, changing and getting the push error, just as I was writing this question, eventually it succeeded:

$ git push --all
Password for 'https://[email protected]': 
Counting objects: 5, done.
Writing objects: 100% (3/3), 246 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://[email protected]/771e0ca9b9f1fa17464373266400386f.git
   b706450..0f958d5  master -> master

... so I'm guessing I wasn't typing my password right. Still, let's keep this Q/A online, as I didn't find an example exactly worded like this one (and had I found one, I would have probably tried a bit harder to enter the right password).


Note to self: remote: Gist does not support directories.

Upvotes: 2

Related Questions