我刚刚开始使用 Git。我使用 Windows 7 并安装了 msysgit(1.7.8) 和 Tortoisegit(1.7.6)。
该存储库是在可通过 LAN 访问的 Linux 服务器上创建的。我面临的问题是我无法使用 Tortoisegit 克隆存储库,它要求输入密码,但我不确定它要求的密码是什么。
同时我可以使用 Git Gui 克隆存储库并执行所有操作。
任何人都可以帮助我理解为什么 Tortoisegit 询问密码而 Git Gui 不询问密码。
我尝试卸载 Git 和 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.
发布评论
评论(17)
我的同事解决了这个问题。步骤:
C:\Program Files (x86)\Git\bin\ssh.exe
代码>或者:
My colleague solved the problem. Steps:
C:\Program Files\TortoiseGit\bin\TortoisePlink.exe
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如果您需要使用用户名/密码,有一个比当前#2 答案更简单的解决方案:
右键单击 -->乌龟Git -->设置--> git -->凭证-->选择“Wincred,所有Windows用户”-->点击应用
下次输入存储库密码时,该密码将自动保存。
如果您使用的存储库需要 SSH 密钥而不是用户名/密码(这听起来像是 OP 的原始问题),您需要
右键单击 -->乌龟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
Right-click --> Tortoise Git --> Settings --> Git --> Remotes
. Find your remote (usually 'origin') then load the PuTTY key from step 2.要无需密钥即可完成此操作...
右键单击您的文件夹
选择tortoiseGit->设置->Git->Remote
选择来源(或您为主遥控器标记的任何内容)
在 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.
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
使用 TortoiseGit 保存用户名和密码
在 TortoiseGit 中保存您的登录详细信息非常简单。无需每次执行拉取或推送操作时输入用户名和密码。
创建一个名为 _netrc 的文件,其中包含以下内容:
机器 github.com
登录您的登录名
密码 yourpassword
将文件复制到 C:\Users\(或其他位置;这恰好是我放置它的位置)
转到命令提示符,键入 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.
Create a file called _netrc with the following contents:
machine github.com
login yourlogin
password yourpassword
Copy the file to C:\Users\ (or another location; this just happens to be where I’ve put it)
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/
我有同样的问题。
我的环境是 Windows 10,TortoiseGit 2.3.0.0 和 git 版本 2.11.0.windows.1
以下解决了我的问题:
到 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:
to C:\Program Files\Git\usr\bin\ssh.exe
一种方法是
已经有密钥)
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
already have a key)
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.
要自动进行身份验证,请使用:
显然,不要将密码存储在文本文件中,除非存储库不重要。
TortoiseGit >1.8.1 安装帮助程序 git-credential-winstore,它提供本地 API 来访问和存储您的现有本地 Windows 凭据存储。
您可以通过转到控制面板 → 用户帐户 → 凭据管理器并选择“Windows 凭据”来查看存储的凭据。以“git:”开头的条目来自 git-credential-winstore。
您可以通过以下方式设置每个存储库的 wincred:
(GUI)
(CLI, POSH)
cmdkey /add:git:https://[电子邮件]受保护] /user:用户名 /pass:PASSWORD
<前><代码>@"
[凭据]
助手 = wincred
“@ | Out-File -FilePath $repoRoot\.git\config -Append
您可以使用
cmdkey /list:git:*
列出为存储库存储的所有凭据存储后,cmdkey 不会显示密码 (http://ss64.com/nt/cmdkey.html)
要列出所有带有密码的凭据,您需要使用 Windows API。对于 powershell,有 CredMan :
To automate authenticating either use:
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)
(CLI, POSH)
cmdkey /add:git:https://[email protected] /user:USERNAME /pass:PASSWORD
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:
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.我做了什么来解决这个问题(Windows):
What I did to fix this (windows):
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 ofGit\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)一旦我将私钥和公钥放入 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.
我今天刚刚遇到类似的问题,并且能够从 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
不幸的是,在我的 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/
由于这里提供的解决方案都不适合我,并且在对我在网上找到的解决方案感到非常失望之后,我终于设法在我的机器上修复了这个问题。
我不知道何时或如何将 TortoiseGit putty 设置为始终使用一个特定的密钥,当然,当我尝试使用新的密钥对连接到不同的服务器时,这会导致所有问题。
那么如何解决问题以及如何判断您是否确实遇到与我相同的问题:
plink.exe
的同一目录中打开 Windows 命令提示符plink -v
Reading private key file "C:\Path\To\Some\privateKey.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:
plink.exe
on your machine from hereplink.exe
plink -v <path_to_your_git_clone_repo_link>
Reading private key file "C:\Path\To\Some\privateKey.ppk"
ppk
file and after that it should output something likePageant is running. Requesting keys.
and we actually wanted thisThat 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.
请注意,存储库远程源的 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.
有同样的问题。就我而言,我无法在那里输入密码。连接配置为 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.
卸载 Tortoisegit 应用程序
进行全新安装
下一步
,直到完成
完成
现在您的乌龟并不要求“登录为”
Uninstall Tortoisegit app
Do fresh install
Next
, untilFinish
Finish
Now your Tortoise is not asking for "login as"