GitHub SSH doesn't work

Continuing the discussion from [Error] git push : fatal: Authentication failed:

Using token kinda troublesome and although we know we can manually drag and drop files on GitHub repo when faced worst situation...

GitHub rate_limit always showing 0/60 without doing nothing or even Token on website has been deleted (even worse) when :~$ sudo su - -c "R -e \"devtools::update_packages()\"", try to refer to below links.

# start the ssh-agent in the background
$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ ssh-add
> Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap]
> Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)

Above codes working fine without error but GitHub git push still ask for token.

+(base) :~/Documents/GitHub/CG.IwithR$ git init
Reinitialized existing Git repository in /home/englianhu/Documents/GitHub/CG.IwithR/.git/
+(base) :~/Documents/GitHub/CG.IwithR$ git fetch
+(base) :~/Documents/GitHub/CG.IwithR$ git add -A && git commit -m "update" && git fetch
[master 3b5844a] update
 1 file changed, 1 insertion(+), 1 deletion(-)
+(base) :~/Documents/GitHub/CG.IwithR$ git push
-error: unable to read askpass response from 'rpostback-askpass'
-fatal: could not read Username for 'https://github.com': terminal prompts disabled
+(base) :~/Documents/GitHub/CG.IwithR$ ssh -T git@github.com
Hi englianhu! You've successfully authenticated, but GitHub does not provide shell access.
+(base) :~/Documents/GitHub/CG.IwithR$ eval "$(ssh-agent -s)"
Agent pid 237003
+(base) :~/Documents/GitHub/CG.IwithR$ ssh-add
Identity added: /home/englianhu/.ssh/id_rsa (englianhu@gmail.com)
Identity added: /home/englianhu/.ssh/id_ed25519 (englianhu@gmail.com)
+(base) :~/Documents/GitHub/CG.IwithR$ git push
-error: unable to read askpass response from 'rpostback-askpass'
-fatal: could not read Username for 'https://github.com': terminal prompts disabled
+(base) :~/Documents/GitHub/CG.IwithR$ git push
-remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
-remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
-fatal: Authentication failed for 'https://github.com/englianhu/CG.IwithR.git/'
1 Like

I know this is not a general help forum, but just to share my piece when dealing with this issue: I had to switch from https to ssh url. This resolved the issue.

Originally posted by @ratnanil in Very common RStudio/git problem+solution: "error: unable to read askpass response from 'rpostback-askpass'" · Issue #93 · STAT545-UBC/Discussion · GitHub

:+1:t2:

You can only push to two types of URL addresses:

  • An HTTPS URL like https://github.com/user/repo.git
  • An SSH URL, like git@github.com:user/repo.git

Git associates a remote URL with a name, and your default remote is usually called origin .

source: About remote repositories - GitHub Docs

Referred to above link and works (Noted, HTTPS URL required tokens but SSH URL properties won't).

+$ git remote set-url origin git@github.com:englianhu/CG.IwithR.git
+(base) :~/Documents/GitHub/CG.IwithR$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 322 bytes | 322.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To github.com:englianhu/CG.IwithR.git
   cb54c01..3b5844a  master -> master

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.