Tortoisegit 询问密码

发布于 2024-12-27 06:50:50 字数 350 浏览 1 评论 0 原文

我刚刚开始使用 Git。我使用 Windows 7 并安装了 msysgit(1.7.8) 和 Tortoisegit(1.7.6)。 该存储库是在可通过 LAN 访问的 Linux 服务器上创建的。我面临的问题是我无法使用 Tortoisegit 克隆存储库,它要求输入密码,但我不确定它要求的密码是什么。 同时我可以使用 Git Gui 克隆存储库并执行所有操作。 任何人都可以帮助我理解为什么 Tortoisegit 询问密码而 Git Gui 不询问密码。 我尝试卸载 Git 和 Tortoisegit 然后重新安装但没有成功。

Tortoisegit 错误

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 LAN. The issue I'm facing is I'm not able to clone the repository using Tortoisegit, it asks for password and I'm not sure what password it is asking.
At the same time I could clone the repository using Git Gui and do all operations.
Can anybody please help me on understanding why Tortoisegit is asking password when Git Gui doesn't.
I tried uninstalling Git and Tortoisegit and then install again but no success.

Tortoisegit error

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(17

淡淡離愁欲言轉身 2025-01-03 06:50:50

我的同事解决了这个问题。步骤:

  1. 右键-> TortoiseGit->设置->网络
  2. SSH 客户端指向 C:\Program Files\TortoiseGit\bin\TortoisePlink.exe
  3. 路径已更改为 C:\Program Files (x86)\Git\bin\ssh.exe代码>

或者:

  • <代码>C:\Users\...\AppData\Local\Programs\Git\usr\bin\ssh.exe
  • <代码>C:\Program Files\Git\usr\bin\ssh.exe - 使用 Git 2.37.3

My colleague solved the problem. Steps:

  1. Right click -> TortoiseGit -> Settings -> Network
  2. SSH client was pointing to C:\Program Files\TortoiseGit\bin\TortoisePlink.exe
  3. Changed path to C:\Program Files (x86)\Git\bin\ssh.exe

Alternatively:

  • C:\Users\...\AppData\Local\Programs\Git\usr\bin\ssh.exe
  • C:\Program Files\Git\usr\bin\ssh.exe - with Git 2.37.3
随波逐流 2025-01-03 06:50:50

如果您需要使用用户名/密码,有一个比当前#2 答案更简单的解决方案:

右键单击 -->乌龟Git -->设置--> git -->凭证-->选择“Wincred,所有Windows用户”-->点击应用

下次输入存储库密码时,该密码将自动保存。


如果您使用的存储库需要 SSH 密钥而不是用户名/密码(这听起来像是 OP 的原始问题),您需要

  1. 在 PuTTY gen 中打开 SSH 密钥(自行安装与 Tortoise Git 一起)
  2. 在 PuTTY gen 中,将密钥保存为 PuTTY 密钥。
  3. 在存储库中,右键单击 -->乌龟Git -->设置--> git -->遥控器。找到您的远程(通常是“来源”),然后加载第 2 步中的 PuTTY 密钥。

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.
风和你 2025-01-03 06:50:50

要无需密钥即可完成此操作...

右键单击您的文件夹
选择tortoiseGit->设置->Git->Remote
选择来源(或您为主遥控器标记的任何内容)

在 URL 下使用此格式。

Https://USERNAME:PASSWORD@URL

其中
USERNAME 是您的用户名
: 冒号分隔用户名和密码并且必须存在
PASSWORD 是您的密码
@ 将凭据与您的 url 分隔
URL 是您用来连接到 .git 资源的 url

感谢卡马奇

To do it without keys...

Right click on your folder
Select tortoiseGit->settings->Git->Remote
Select origin (or whatever you have labeled your main remote)

Under URL use this format.

Https://USERNAME:PASSWORD@URL

Where
USERNAME is your username
: the colon separates username and password and must be there
PASSWORD is your password
@ separates credentials with your url
URL is the url you would use to connect to the .git resource


Thanks goes to Kamaci

满天都是小星星 2025-01-03 06:50:50

使用 TortoiseGit 保存用户名和密码

在 TortoiseGit 中保存您的登录详细信息非常简单。无需每次执行拉取或推送操作时输入用户名和密码。

  1. 创建一个名为 _netrc 的文件,其中包含以下内容:

    机器 github.com
    登录您的登录名
    密码 yourpassword

  2. 将文件复制到 C:\Users\(或其他位置;这恰好是我放置它的位置)

  3. 转到命令提示符,键入 setx home C:\Users\

注意:如果您使用的是 Windows 之前的版本7、setx命令可能不适合你。请改用 set,并通过“我的电脑”下的“高级设置”将主环境变量添加到 Windows。

归功于:
http://www.munsplace.com/blog/2012 /07/27/ saving-username-and-password-with-tortoisegit/

Saving username and password with TortoiseGit

Saving your login details in TortoiseGit is pretty easy. Saves having to type in your username and password every time you do a pull or push.

  1. Create a file called _netrc with the following contents:

    machine github.com
    login yourlogin
    password yourpassword

  2. Copy the file to C:\Users\ (or another location; this just happens to be where I’ve put it)

  3. Go to command prompt, type setx home C:\Users\

Note: if you’re using something earlier than Windows 7, the setx command may not work for you. Use set instead and add the home environment variable to Windows using via the Advanced Settings under My Computer.

CREDIT TO:
http://www.munsplace.com/blog/2012/07/27/saving-username-and-password-with-tortoisegit/

凹づ凸ル 2025-01-03 06:50:50

我有同样的问题。
我的环境是 Windows 10,TortoiseGit 2.3.0.0 和 git 版本 2.11.0.windows.1

以下解决了我的问题:

  • 右键单击 -> TortoiseGit->设置->网络
  • 更新 SSH 客户端
    到 C:\Program Files\Git\usr\bin\ssh.exe

在此处输入图像描述

I had the same issue.
My environment is windows 10 with TortoiseGit 2.3.0.0 and git version 2.11.0.windows.1

The following solved my problem:

  • Right click -> TortoiseGit -> Settings -> Network
  • Update SSH client
    to C:\Program Files\Git\usr\bin\ssh.exe

enter image description here

临风闻羌笛 2025-01-03 06:50:50

一种方法是

  • 使用 PuttyGen 生成密钥对(或者导入到 .ppk,如果您
    已经有密钥)
  • 将私钥加载到 Peagent
  • 将公钥导入到您的 gitosis 服务器(将您的公钥提供给管理员)
  • ,然后使用 plink 作为 SSH 客户端

plink 与 Peagent 一起本地工作以检索加载的密钥。

你可以在标准 putty 发行版中找到 plink.exe 以及 Peagent 和其他好东西

来使用它,转到:

TortoiseGit 设置 ->网络-> SSH 客户端。

默认情况下,它包含 TortoisePlink.exe 的路径,而不是提供 plink.exe 的路径。

或者,您可以在 msys(git) 分发中使用 ssh(.exe),但不能使用 .ppk 格式/Peagent 组合的私钥。您需要通过 PuttyGen 将密钥导出为 OpenSSH 格式,或者使用 ssh-keygen 创建密钥对。

One way to do this is

  • generate a keypair using PuttyGen, (or import into .ppk if you
    already have a key)
  • load the private key to peagent
  • import public key to you gitosis server (supply your public key to your admin)
  • and then use plink as SSH client

plink works natively with peagent to retrieve the loaded key.

you can find plink.exe along with peagent and other goodies in standard putty distribution

to use it go to:

TortoiseGit Settings -> Network -> SSH client .

by default this contains path to TortoisePlink.exe, instead of that give path to plink.exe

Alternatively you can use ssh(.exe) in msys(git) distribution but then you cannot use private key in .ppk format/Peagent combination. You either need to export your key to OpenSSH format via PuttyGen or create a keypair using ssh-keygen instead.

夜血缘 2025-01-03 06:50:50

要自动进行身份验证,请使用:

  1. 正如其他人已经指出的那样,使用 SSH 密钥,或者
  2. 使用内置的凭据帮助程序。

显然,不要将密码存储在文本文件中,除非存储库不重要。

TortoiseGit >1.8.1 安装帮助程序 git-credential-winstore,它提供本地 API 来访问和存储您的现有本地 Windows 凭据存储

您可以通过转到控制面板 → 用户帐户 → 凭据管理器并选择“Windows 凭据”来查看存储的凭据。以“git:”开头的条目来自 git-credential-winstore。

您可以通过以下方式设置每个存储库的 wincred:

(GUI)

  1. 导航到文件资源管理器中的存储库。
  2. 右键单击 → TortoiseGit → 设置 → Git → 凭据 凭据
  3. 助手:wincred - 仅此存储库
  4. 下次使用存储库进行身份验证时,将存储凭据。

(CLI, POSH)

  1. cmdkey /add:git:https://[电子邮件]受保护] /user:用户名 /pass:PASSWORD
  2.  

    <前><代码>@"
    [凭据]
    助手 = wincred
    “@ | Out-File -FilePath $repoRoot\.git\config -Append

您可以使用 cmdkey /list:git:* 列出为存储库存储的所有凭据
存储后,cmdkey 不会显示密码 (http://ss64.com/nt/cmdkey.html

要列出所有带有密码的凭据,您需要使用 Windows API。对于 powershell,有 CredMan :

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

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://[email protected] /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
夜灵血窟げ 2025-01-03 06:50:50

URL 和窗口标题 TortoisePlink 都表明 tortoise 正在尝试使用 ssh 作为传输协议。 git 支持不止一种传输协议,包括文件系统访问和 ssh 访问。在您的问题中,您描述的是您希望通过文件系统访问来访问远程存储库。在这种情况下,您的远程 URL 应类似于 file://server/path/to/repo。请再次检查您的远程存储库 URL。

The URL and the window title TortoisePlink both indicate that tortoise are trying to use ssh as the transport protocol. git support more than one transport protocol, including file system access, and ssh access. In your question, you are describing that you want to access your remote repo by file system access. In that case your remote url should look something like file://server/path/to/repo. Please check your remote repo URL again.

梦言归人 2025-01-03 06:50:50

我做了什么来解决这个问题(Windows):

  1. 打开PuttyGen导入我的ssh密钥并将其转换为putty密钥,将公共和私有部分保存在.ssh文件夹中(%userprofile%.ssh)
  2. 打开Putty并转到Connection-> ;SSH->Auth 然后在那里设置您的私钥文件。
  3. 返回会话,选择默认设置并点击保存。
  4. 现在再次尝试克隆,系统会要求您输入 ssh 密钥上的密码,输入它,它应该可以工作。

What I did to fix this (windows):

  1. Open PuttyGen import my ssh key and convert it into a putty key, save both public and private parts in the .ssh folder (%userprofile%.ssh)
  2. Open Putty and go to Connection->SSH->Auth then set your private key file there.
  3. Go back to Session, select Default Settings and hit Save.
  4. Now try to clone again and you will be asked for the passphrase on your ssh key, enter it and it should work.
云淡月浅 2025-01-03 06:50:50

Pramodtech 的答案在当前版本的官方 Windows Git 客户端中不再适用。它现在将 ssh 可执行文件存储在 Git\usr\bin 中,而不是 Git\bin(自 2015 年 8 月发布的 2.5 版本起)。

所以去 TortoiseGit >设置> Network 并将 SSH 客户端路径更改为:

C:\Program Files\Git\usr\bin\ssh.exe(或任何 Git 安装路径)

在此处输入图像描述

Pramodtech's answer stopped working for me with the current version of the official Windows Git client. It stores the ssh executable in Git\usr\bin instead of Git\bin now (since version 2.5 released in Aug 2015).

So go to TortoiseGit > Settings > Network and change the SSH client path to:

C:\Program Files\Git\usr\bin\ssh.exe (or whatever the path to your Git installation is)

enter image description here

如果没有 2025-01-03 06:50:50

一旦我将私钥和公钥放入 C:\Users\.ssh 目录中,Tortoise GIT DOS 命令行就停止询问我的密码。我使用的是 Windows 7。

Tortoise GIT DOS command line stopped asking for my password once I placed my private and public keys in C:\Users\.ssh dir. I am on Windows 7.

小苏打饼 2025-01-03 06:50:50

我今天刚刚遇到类似的问题,并且能够从 https:// 安装最新版本的 git 来修复它git-scm.com/download/win

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

隱形的亼 2025-01-03 06:50:50

不幸的是,在我的 Windows 8 机器上,重新指向 SSH 客户端的解决方案不起作用。为我解决问题的解决方案在这里: http://www.munsplace.com/blog/2012/07/27/ saving-username-and-password-with-tortoisegit/

Unfortunately, on my machine with Windows 8 the solution with repointing SSH client didn't work. Solution that solved the problem for me is here: http://www.munsplace.com/blog/2012/07/27/saving-username-and-password-with-tortoisegit/

追星践月 2025-01-03 06:50:50

由于这里提供的解决方案都不适合我,并且在对我在网上找到的解决方案感到非常失望之后,我终于设法在我的机器上修复了这个问题。

我不知道何时或如何将 TortoiseGit putty 设置为始终使用一个特定的密钥,当然,当我尝试使用新的密钥对连接到不同的服务器时,这会导致所有问题。

那么如何解决问题以及如何判断您是否确实遇到与我相同的问题:

  1. plink.exe 在您的计算机上。 org.uk/~sgtatham/putty/download.html" rel="nofollow">此处
  2. 在下载 plink.exe 的同一目录中打开 Windows 命令提示符
  3. 运行以下命令: plink -v
  4. 查看输出并查看是否有像这样的行 Reading private key file "C:\Path\To\Some\privateKey.ppk"
  5. 如果您看到这样的行,并且它不是您想要使用的 putty 密钥文件,然后只需重命名/删除/移动该文件,以便 plink 下次无法加载它。
  6. 重命名有问题的文件后,它应该全部按预期工作,如果您从第 3 点运行命令。您应该看到 plink 现在无法加载该 ppk 文件,之后它应该输出类似 Pageant is running 的内容。请求密钥。我们实际上想要这个

就是这样,如果有人知道我如何禁用这个“全局默认腻子密钥”,请在评论中告诉我,我将用信息更新这个答案。

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.

一瞬间的火花 2025-01-03 06:50:50

请注意,存储库远程源的 URL 可能会导致此问题。我有一个运行良好的旧存储库,还有一个我刚刚克隆的新存储库,它要求我输入密码。

比较设置>中的信息后, git >远程> Url 我看到有效的有:

[email protected ]:githubAccount/repoName.git

新的不起作用了https 地址。

另请参阅下面的屏幕截图。

输入图片此处描述

Please not the URL of the repo remote origin can cause this problem. I had an old repo that worked perfectly and a new one I just cloned that was asking me for password.

Upon comparing the information in Settings > Git > Remote > Url I saw that the one which worked had:

[email protected]:githubAccount/repoName.git

The new one that did not work had an https address.

Please see screenshot below as well.

enter image description here

你没皮卡萌 2025-01-03 06:50:50

有同样的问题。就我而言,我无法在那里输入密码。连接配置为 SSH,但没有为存储库定义密钥。

查看:TortoiseGIT SSH 配置。这些说明适用于 cloudforge,但对于其他服务,您必须执行相同的操作,只需向 git 存储库提供商提供您的公钥即可。

Had the same problem. In my case there was no password I could enter there. The connection was configured as SSH but there were no keys defined for repo.

Check out: TortoiseGIT SSH configuration. Those instructions are for cloudforge, but for other services you have to do the same, just provide your public key to your git repository provider.

丘比特射中我 2025-01-03 06:50:50

卸载 Tortoisegit 应用程序
进行全新安装

  • 初始步骤单击下一步,直到完成
  • 在启动向导步骤下,在下拉列表中提供 OpenSSH 选项
  • 然后单击完成

现在您的乌龟并不要求“登录为”

Uninstall Tortoisegit app
Do fresh install

  • Initial steps click Next, until Finish
  • Under start wizard step, in the drop-down list give OpenSSH option
  • Then click Finish

Now your Tortoise is not asking for "login as"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文