Tortoisegit asking password

后端 未结 16 1499
栀梦
栀梦 2020-12-04 11:10

I just started to work on Git. I use windows 7 and has installed msysgit(1.7.8) and Tortoisegit(1.7.6). The repository is created on Linux server which is accessible thru LA

16条回答
  •  孤城傲影
    2020-12-04 11:48

    To automate authenticating either use:

    1. SSH keys as others have already pointed out, or
    2. the built-in credential helper.

    Obviously, do not store your password in a text file unless the repo is not important.

    TortoiseGit >1.8.1 installs the helper git-credential-winstore which provides the local API to access and store your login info in the existing, local Windows Credential Store.

    You can see the stored credentials by going to Control Panel → User Accounts → Credential Manager and choosing "Windows Credentials". The entries starting "git:" are from git-credential-winstore.

    You can set up wincred per repository by:

    (GUI)

    1. Navigate to the repository in File Explorer.
    2. Context-click → TortoiseGit → Settings → Git → Credential
    3. Credential helper: wincred - this repository only
    4. The next time you authenticate with the repo, the credentials will be stored.

    (CLI, POSH)

    1. cmdkey /add:git:https://USERNAME@github.com /user:USERNAME /pass:PASSWORD
    2.  

      @"
      [credential]
              helper = wincred
      "@ | Out-File -FilePath $repoRoot\.git\config -Append
      

    You can list all credentials stored for repos with cmdkey /list:git:*
    Once stored, passwords are not displayed by cmdkey (http://ss64.com/nt/cmdkey.html)

    To list all credentials with passwords you need to use the Windows API. For powershell, there's CredMan:

    . .\CredMan.ps1
    .\CredMan.ps1 -ShoCred
    

提交回复
热议问题