How to stop github always asking for username / password?

Michael Durrant

I have my keys in ~/.ssh/ and on other computers I can push and pull from the repo in question.
Why on one computer do I always need to enter my github username/password but not on others?

What could I change to avoid this and use my ssh keys instead ?

Michael Durrant

This can be changed by changing the authentication protocol method from https to ssh

One option would be to rename or delete the existing repo and then 'reclone' with the different method. So after mving or rm -ring the current repo, the clone command will be something like

git clone [email protected]:user_name/repo_name.git

You can see the difference in the two approaches with the git config -l command:

For https:

...
remote.origin.url=https://github.com/user_name/repo_name.git
...

For ssh

...
[email protected]:user_name/repo_name.git
branch.master.rebase=true  # This was also created in the ssh method

...

You can see the difference in the .git/config file for each repo:

Note the change in 'url' below. Plus addition of rebase = true in ssh

http

[core]
  repositoryformatversion = 0 
  filemode = true
  bare = false
  logallrefupdates = true
[remote "origin"]
  url = https://github.com/user_name/repo_name.git
  fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
  remote = origin
  merge = refs/heads/master

ssh

[core]
  repositoryformatversion = 0 
  filemode = true
  bare = false
  logallrefupdates = true
[remote "origin"]
  url = [email protected]:user_name/repo_name.git
  fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
  remote = origin
  merge = refs/heads/master
  rebase = true

So if you want to just change the authentication method without 'recloning' the entire repo you can just edit the projects .git/config and change

  url = [email protected]_name/repo_name.git

to

  url = https://github.com/user_name/repo_name.git

plus add

rebase = true

at the bottom, in the "[branch "master"]" section

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

django JWT asking for username/password

From Dev

How to make Apache 2 stop asking for a password for an SSL certificate?

From Dev

How to make Apache 2 stop asking for a password for an SSL certificate?

From Dev

SourceTree keeps asking for Github password

From Java

GitHub: invalid username or password

From Dev

Git on Yosemite keeps asking for remote username and password

From Dev

RestController asking username and password in Spring JAVA project

From Dev

windows 10 Lock Screen: asking for username and password

From Dev

gofabric8 deploy asking for for Username/Password

From Dev

How to remove Win10 login screen asking for username and password (showing despite netplwiz indicating it shouldn't be)?

From Dev

Stop Ubuntu asking for password to mount second drive

From Dev

Stop Ubuntu asking for password to mount second drive

From Dev

Keychain always asking for password when running codesign

From Dev

How to take the username and password of a user to register in GitHub via the API?

From Dev

how to set username and password for github in jenkins job xml?

From Dev

How to resolve unable to push to GitHub due to "Invalid username or password"?

From Dev

How do I stop GitX asking me for my SSH key password?

From Dev

Email account expired - how can I get Outlook 2010 to stop asking for a password?

From Dev

Gitlab 6.2 asking for username and password authentication when pushing to origin

From Dev

googleads.g.doubleclick.net Asking for Username and Password

From Dev

Why does mutt keep asking for imap username and password?

From Dev

Gitlab 6.2 asking for username and password authentication when pushing to origin

From Dev

My Samba share isnt asking for username and password when connecting

From Dev

Always prompts for username and password when printing

From Dev

Username and Password validation always returns true (with firebase)

From Dev

chef-solo stop asking server password multiple times

From Dev

Windows 10 - won't stop asking for a password no matter the settings

From Dev

make nautilus stop asking for password when mounting disk

From Dev

chsh always asking a password , and get `PAM: Authentication failure`

Related Related

  1. 1

    django JWT asking for username/password

  2. 2

    How to make Apache 2 stop asking for a password for an SSL certificate?

  3. 3

    How to make Apache 2 stop asking for a password for an SSL certificate?

  4. 4

    SourceTree keeps asking for Github password

  5. 5

    GitHub: invalid username or password

  6. 6

    Git on Yosemite keeps asking for remote username and password

  7. 7

    RestController asking username and password in Spring JAVA project

  8. 8

    windows 10 Lock Screen: asking for username and password

  9. 9

    gofabric8 deploy asking for for Username/Password

  10. 10

    How to remove Win10 login screen asking for username and password (showing despite netplwiz indicating it shouldn't be)?

  11. 11

    Stop Ubuntu asking for password to mount second drive

  12. 12

    Stop Ubuntu asking for password to mount second drive

  13. 13

    Keychain always asking for password when running codesign

  14. 14

    How to take the username and password of a user to register in GitHub via the API?

  15. 15

    how to set username and password for github in jenkins job xml?

  16. 16

    How to resolve unable to push to GitHub due to "Invalid username or password"?

  17. 17

    How do I stop GitX asking me for my SSH key password?

  18. 18

    Email account expired - how can I get Outlook 2010 to stop asking for a password?

  19. 19

    Gitlab 6.2 asking for username and password authentication when pushing to origin

  20. 20

    googleads.g.doubleclick.net Asking for Username and Password

  21. 21

    Why does mutt keep asking for imap username and password?

  22. 22

    Gitlab 6.2 asking for username and password authentication when pushing to origin

  23. 23

    My Samba share isnt asking for username and password when connecting

  24. 24

    Always prompts for username and password when printing

  25. 25

    Username and Password validation always returns true (with firebase)

  26. 26

    chef-solo stop asking server password multiple times

  27. 27

    Windows 10 - won't stop asking for a password no matter the settings

  28. 28

    make nautilus stop asking for password when mounting disk

  29. 29

    chsh always asking a password , and get `PAM: Authentication failure`

HotTag

Archive