11

I have created and successfully implemented a Git project on the Codaset website. I am using SSH to communicate between my Codaset and my local repository. When I do a push from Git Bash, Git Bash asks me for my user name credentials. Although, Git Bash performs the push successfully, it is tedious to having to enter my user credentials every time I perform a push.

I have checked out many blogs and suggestions to fix this problem, but to no avail. Also, I have tried to use PuTTY. My questions are:

  1. How can I fix this problem?
  2. Or, can I turn on some debugging to at least identify the precise reason(s) why Git Bash is asking for my user credentials?
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user32585
  • 147
  • 1
  • 1
  • 4

4 Answers4

18

In your terminal, type:

git config -l

This will bring up your repository's configuration information. Look at the row remote.origin.url. From what you're describing it should be: https://github.com/Username/project.git.

That means it's using the HTTP protocol instead of SSH! I just had this problem too :) There is an easy fix, though!

Just execute this in the terminal:

git config remote.origin.url git@github.com:Username/project.git

It should take care of things!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
starscream_disco_party
  • 2,816
  • 5
  • 26
  • 42
  • 2
    GitHub recently changed their default instructions. When you create a new repo, it suggests that you use their Mac app, and it follows with the http config setup rather than ssh. – Micah Alcorn Sep 17 '12 at 21:18
  • I am using Gitlab and mine uses ssh but still keeps asking for password – pal4life Dec 22 '15 at 17:25
  • 1
    That helped. An alternate command to set the url is ```git remote set-url origin git@github.com:username/project.git``` – rojobuffalo Feb 25 '16 at 01:59
3

Set up public key authentication for SSH. If you do that, Git shouldn't ask for your password every time.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mipadi
  • 398,885
  • 90
  • 523
  • 479
  • Thank you. With reference to the link, I created a public key and uploaded it onto the Codaset website accoring to the Codaset instructions. How can I determine if I am actually using a public key from Git Bash? – user32585 May 11 '11 at 15:43
  • SSH straight to the remote site using -v. It will tell you which authentication keys are being used. – Mauvis Ledford May 11 '11 at 19:47
1

Git documentation is the best :). Try these steps first in Git Bash - Windows and after this, look on other sites:

For Eclipse: "Auth Failed" error with EGit and GitHub.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
1

You need to set up SSH public key authentication. I described this process in my answer to this question). You can use it with Git Bash.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
beduin
  • 7,943
  • 3
  • 27
  • 24
  • Thank you. Please can you tell me what are the exact commands I need to use in Git Bash to setup the correct config? – user32585 May 11 '11 at 15:46
  • @user583153: if you have already uploaded public key onto Codaset Website then you have to ensure, that corresponding _private key_ is placed under `~/.ssh/` folder on your host. Under Git Bash run `cd ~; mkdir .ssh; cp private_key ~/.ssh/id_rsa` – beduin May 11 '11 at 18:54