1

Is there a way like to temporary store git login but not password ?

Something like using the following (source: Skip pwd typing using github)

git config --global credential.helper cache
git config --global credential.helper "cache --timeout=3600"

but without caching the password ?

Currently I use git remote address like https:// myLogin @github.com/Owner/Project.git to my terminal don't ask me my login every time, but it's not a temporary solution (or each time remain to change remote repository link to add or remove my login).

Community
  • 1
  • 1
NatNgs
  • 874
  • 14
  • 25

1 Answers1

2

You could set a config rule for github.com:

git config --global url."https://myLogin@github.com".insteadOf https://github.com

That way, your urls remains https://github.com/user/repo, but any pull/fetch command would actually use https://myLogin@github.com/...

The cache credential helper remains for caching user/password only, not just user.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Good idea, for now I will use this solution because simplify for when I have many projects; but it's not more temporary than what I do :P – NatNgs Jul 21 '16 at 09:09
  • @NathaëlNoguès it is a global config, so it will remain valid on your workstation forever (as long as you don't change your global git config). As opposed to setting the user in each url, which you have to do for each new cloned repo. – VonC Jul 21 '16 at 09:10