为什么带有 GIT 的 TFS 不能从命令行工作?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37736232/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why TFS with GIT is not working from command line?
提问by Jairo Andres Velasco Romero
I want to use the git command line tools with the Microsoft Team Foundation Server Git repositories.
我想在 Microsoft Team Foundation Server Git 存储库中使用 git 命令行工具。
But every time I want to access to remote repos the authentication fails. And of course I am using Active Directory (this is a TFS server). The git repo management works perfectly from Visual Studio. (even push, sync, clone, etc).
但是每次我想访问远程存储库时,身份验证都会失败。当然,我使用的是 Active Directory(这是一个 TFS 服务器)。git repo 管理在 Visual Studio 中完美运行。(甚至推送、同步、克隆等)。
Cloning into 'blabla'
fatal: Authentication failed for 'http://server:8080/tfs/BlaCollection/_git/blabla/'
I have intented using this patters and always fail.
我有意使用这种模式,但总是失败。
- DOMAIN\username
- username@domainforest
- 域\用户名
- 用户名@域森林
Anyone has get connected using command line tools to a TFS with git server? In my company we use tokens to log on Windows, may be the reason?
有人使用命令行工具通过 git 服务器连接到 TFS 吗?在我公司我们使用令牌登录Windows,可能是原因?
采纳答案by Jairo Andres Velasco Romero
Finally a collegue hit the solution and I will post it here:
最后一位同事找到了解决方案,我将在此处发布:
Use the command:
使用命令:
git config --global credential.http://[tfs_server].integrated true
Of course, replace [tfs_server]
with your own TFS server host name.
当然,替换[tfs_server]
成你自己的TFS服务器主机名。
When Credential Manager asks for credentials just leave blanks and press OK. (I this way authentication will be performed using Kerberos).
当凭据管理器要求提供凭据时,只需留空并按 OK。(我这样身份验证将使用 Kerberos 执行)。
Check here for more information https://github.com/Microsoft/Git-Credential-Manager-for-Windows#q-i-thought-microsoft-was-maintaining-this-why-does-the-gcm-not-work-as-expected-with-tfs
回答by Kirill Chilingarashvili
Windows Credentials -> Generic Credentials
Windows 凭据 -> 通用凭据
Then add a new item with "git:" in front of the http:// i.e.:
然后在 http:// 前面添加一个带有“git:”的新项目,即:
混帐:http: //Example.com
add domain\user as user, and password
添加域\用户作为用户和密码
回答by Karthikeyan VK
回答by jausel
For myself, I went to Control Panel > Credential Manager > Windows Credentials.
对于我自己,我转到控制面板 > 凭据管理器 > Windows 凭据。
I tried to delete only the Generic Credentials with git:in front of them, but the git commands still didn't work.
我试图只删除git:前面的通用凭证,但 git 命令仍然不起作用。
After I deleted the Windows Credentials for the TFS server, then the git commands started to work.
在我删除 TFS 服务器的 Windows 凭据后,git 命令开始工作。
回答by Sephiroth Bloodsteel
No matter, how your company use to log on windows, you just need the account which login in the TFS. You can find the account info in Windows-Control Panel- Credential Manager
by PatrickLu-MSFT
无论您的公司如何使用Windows登录,您只需要在TFS中登录的帐户即可。您可以在PatrickLu-MSFT
的Windows-控制面板-凭据管理器中找到帐户信息
This is what did it for me. I just opened the Windows Credential Manager as stated above and edited the credentials because some how it was stuck to my previous password.
这就是为我所做的。我刚刚如上所述打开了 Windows 凭据管理器并编辑了凭据,因为它是如何固定在我以前的密码中的。
回答by Hem
If you face this error after changing password for TFS,
如果您在更改 TFS 密码后遇到此错误,
Go to Control Panel\User Accounts\Credential Manager
转到控制面板\用户帐户\凭据管理器
Under the Windows Credentials, Modify the password for the specific Internet or network address.
在 Windows 凭据下,修改特定 Internet 或网络地址的密码。
回答by Patrice Calvé
Did you change your AD password recently ?
您最近是否更改了 AD 密码?
- If so, (or not lol), Go to Control Panel > User Accounts > Credential Manager > Windows Credentials.
- Locate entries starting with git:http...
- Either Remove that/those entry, or edit the password to the new one. Click on the Down Arrow and you see info about that entry, including the Remove/Edit links
- 如果是这样,(或不是大声笑),请转到控制面板 > 用户帐户 > 凭据管理器 > Windows 凭据。
- 找到以 git:http... 开头的条目
- 删除那个/那些条目,或者将密码编辑为新的。单击向下箭头,您会看到有关该条目的信息,包括删除/编辑链接
回答by Victor Ca?as
My solution
我的解决方案
Open Control Panel > Credential Manager > Windows Credentials.
打开控制面板 > 凭据管理器 > Windows 凭据。
Under Generic Credentials -> Add a generic credential
在通用凭据下 -> 添加通用凭据
Inter network address: git:https://tfs.[google].com
跨网地址:git: https://tfs.[google].com
admin:
行政:
password:
密码:
Replace google with the domain of your company. Put your EID or credentials to log into TFS.
将 google 替换为您公司的域名。输入您的 EID 或凭据以登录 TFS。
回答by joacar
For me it was that a proxy had been set in config. >git config --global --unset http.proxy
made it work. Running a VM Windows Server 20196 and TFS2015 usind Kerberos (Windows Authentication).
对我来说,是在配置中设置了一个代理。>git config --global --unset http.proxy
使它工作。使用 Kerberos(Windows 身份验证)运行 VM Windows Server 20196 和 TFS2015。
回答by PatrickLu-MSFT
Try to use the Authentication --username
and --password
parameters with the command directly such as:
尝试在命令中直接使用身份验证 --username
和--password
参数,例如:
git tfs clone http://tfs:8080/tfs/DefaultCollection $/Project1 -u=Domain\username -p=xxx
-u, --username=VALUE stands for TFS username
-p, --password=VALUE stands for TFS password
-u, --username=VALUE 代表 TFS 用户名
-p, --password=VALUE 代表 TFS 密码
No matter, how your company use to log on windows, you just need the account which login in the TFS. You can find the account info in Windows-Control Panel- Credential Manager
无论您的公司如何使用Windows登录,您只需要在TFS中登录的帐户即可。您可以在Windows-Control Panel- Credential Manager
Visual Studio store credentials in the Windows Credential Manager, which is compatible with the Git Credential Winstore. If you install Git Credential Winstore, it should permanently authenticating with Git repositories, you can also give this tool a try.
Visual Studio 将凭据存储在与Git Credential Winstore兼容的 Windows 凭据管理器中。如果您安装 Git Credential Winstore,它应该会永久使用 Git 存储库进行身份验证,您也可以尝试使用此工具。