简体   繁体   中英

Git not letting me add my github password when asking for credentials

I've recently changed my github password. I have set up a repo on github and have initialised it on my system. I then added the files and committed them to the master branch. When I go to push something from an R studio project using:

git push -u origin master

I get this message:

error: cannot run rpostback-askpass: No such file or directory Username for 'https://github.com':

This is expected as I have recently changed my password. So I add in my username as requested. I then get this message:

error: cannot run rpostback-askpass: No such file or directory Password for 'https://sue-wallace@github.com':

This is where it gets really odd. I can't type anything at all into the space where I'm supposed to type my password. I've tried it in the terminal for my mac, the shell in R studio and in the terminal in R studio. It all results in the same issue, I can't add the password.

Anyone got any ideas what the issue might be?

Thanks

The easiest solution is to switch the repository URL from https to ssh .
You need to generate ssh key, add it to your profile and then change the URL

Source: https://help.github.com/en/enterprise/2.15/user/articles/adding-a-new-ssh-key-to-your-github-account

Generating ssh key

  • Open Git Bash.
  • Run ssh-keygen and follow the on-screen messages (or simply click Enter till it over)
  • Copy the key file (the content of the public key) located in:

      ~/.ssh/id_rsa.pub 

Add key to Github

  • In the upper-right corner of any page, click your profile photo, then click Settings. 在此处输入图片说明

  • In the user settings sidebar, click SSH and GPG keys.
    在此处输入图片说明

  • Click New SSH key or Add SSH key. 在此处输入图片说明

  • Paste your key into the "Key" field. 在此处输入图片说明

  • Click Add SSH key.
    在此处输入图片说明

  • change the repository url to ssh

     git remote set origin <ssh url> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM