1

First: Let us take a look at the global git config variables:

21:36:51/git $git config -l
credential.helper=osxkeychain
user.name=myuser
user.email=myuser@gmail.com

Now let us try to access read-only to a public repository:

$git clone https://github.com/BVLC/caffee
Cloning into 'caffee'...
Username for 'https://github.com':

Why is it asking for the username??

WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • `user.name` is used as the committer name during `git commit`. It has nothing to do with authentication. – Leon Dec 18 '16 at 05:46
  • @Leon Thanks - I was also a bit surprised about that. Turns out I (slightly) misspelled the repo name (see accepted answer) – WestCoastProjects Dec 18 '16 at 06:00

2 Answers2

2

I suspect this is because the repository doesn't appear to exist - which means you're either hitting a broken link, or the repository is private. If the repository is private then a username/password will be required, when accessing over HTTP. (If you were cloning via ssh then your private key would provide the authentication.)

I see the same thing in your example:

$ git clone https://github.com/BVLC/caffee
Cloning into 'caffee'...
Username for 'https://github.com': ^C

Compare that to a repository which does exist and is public:

$ git clone https://github.com/skx/bookmarks.public
Cloning into 'bookmarks.public'...
remote: Counting objects: 270, done.
remote: Total 270 (delta 0), reused 0 (delta 0), pack-reused 270
Receiving objects: 100% (270/270), 71.74 KiB | 0 bytes/s, done.
..
  • 1
    ah .. there's a spurious extra `e` on the URI I was using.. correct URI is https://github.com/BVLC/caffe . You'd think a somewhat better error message were in order. – WestCoastProjects Dec 18 '16 at 05:48
  • The problem is that there's no way to know that, because if you *aren't* authorized, it 404's out. – Pockets Dec 18 '16 at 07:48
0

To rephrase a SO question which is relevant to your question:

With Git 1.7.9 or later, you can just use one of the following credential helpers:

git config --global credential.helper cache

... which tells Git to keep your password cached in memory for (by default) 15 minutes.

In other words, the credential helper, by default, does not eliminate the need to ever enter your credentials, it just means that Git will cache this information for a certain amount of time.

Community
  • 1
  • 1
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360