Tortoisegit asking password

后端 未结 16 1416
栀梦
栀梦 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:44

    I just face a similar problem today and was able to fix it installing the latest version of git from https://git-scm.com/download/win

    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2020-12-04 11:49

    If you need to use a username/password, there is a much simpler solution than the current #2 answer:

    Right-click --> Tortoise Git --> Settings --> Git --> Credential --> Choose "Wincred, all Windows users" --> Hit apply

    The next time you enter the password for a repo, that password will be automatically saved.


    If you're using a repository that requires SSH keys rather than username/password (which it sounds like was OP's original issue), you need to

    1. Open the SSH key in PuTTY gen (installs itself alongside Tortoise Git)
    2. In PuTTY gen, save the key as a PuTTY key.
    3. In the repository, Right-click --> Tortoise Git --> Settings --> Git --> Remotes. Find your remote (usually 'origin') then load the PuTTY key from step 2.
    0 讨论(0)
  • 2020-12-04 11:49

    Since non of the solutions provided here worked for me, and after a lot disappointments with solutions I found online I finally managed to fix this on my machine.

    I don't know when or how I set up my TortoiseGit putty to always use one specific key, and of course this made all the problems when I tried to connect to different server with new pair of keys.

    So how to fix a problem and how to tell if you actually have same problem as I had:

    1. Download plink.exe on your machine from here
    2. Open windows command prompt in a same directory where you downloaded your plink.exe
    3. Run this command: plink -v <path_to_your_git_clone_repo_link>
    4. Look at the output and see if you have line like Reading private key file "C:\Path\To\Some\privateKey.ppk"
    5. If you see line like this, and it is not putty key file you want to use then just go and rename/delete/move that file so that plink cant load it next time
    6. After you renamed problematic file it should all work as expected, if you run command from point 3. you should see that plink now cant load that ppk file and after that it should output something like Pageant is running. Requesting keys. and we actually wanted this

    That is it, if anyone knows how I can disable this "global default putty key" please let me know in the comments and I'll update this answer with the info.

    0 讨论(0)
提交回复
热议问题