WestCoastProjects
WestCoastProjects

Reputation: 63042

git asking for username even for read operation (clone) although already configured globally

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
[email protected]

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??

Upvotes: 1

Views: 63

Answers (2)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521053

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.

Upvotes: 0

user14038
user14038

Reputation:

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.
..

Upvotes: 2

Related Questions