最近使用微软的 VSTS

www.visualstudio.com

代码托管后,在linux 环境拉取代码总是验证不成功。

解决办法:

Use Git Credential Managers to Authenticate to VSTS

  • 2018/03/14
  • 2 分钟阅读时长

VSTS | TFS 2018 | TFS 2017 | TFS 2015 | VS 2017 | VS 2015

Git Credential Managers simplify authentication with your VSTS/TFS Git repos. Credential Managers let you use the same credentials that you use for the VSTS/TFS web portal and support multi-factor authentication through Microsoft Account (MSA) or Azure Active Directory (AAD). In addition to supporting multi-factor authentication with VSTS, the credential managers also provide support two-factor authentication with GitHub repositories.

VSTS provides IDE support for MSA and AAD authentication through Team Explorer in Visual StudioIntelliJ and Android Studio with the VSTS Plugin for IntelliJ, and Eclipse (with the Team Explorer Everywhere plug-in). If your environment doesn't have an integration available, configure your IDE with a Personal Access Token or SSH to connect with your to your repos.

Install the Git Credential Manager

Windows

Download and run the latest Git for Windows installer, which includes the Git Credential Manager for Windows. Make sure to leave the Git Credential Manager installation option enabled when prompted.

macOS and Linux

Review the system and software requirements before installing the credential manager.

On macOS and Linux, there are several install options that use native package managers to install the credential manager. After installing the package for your platform, run the following command to configure Git to use the credential manager :

> git-credential-manager install

Using the Git Credential Manager

When you connect to a VSTS Git repository from your Git client for the first time, the credential manager prompts for your Microsoft Account or Azure Active Directory credentials. If your account has multi-factor authentication enabled, you are prompted to go through that experience as well.

Once authenticated, the credential manager creates and caches a personal access token for future connections to the repo. Git commands that connect to this account won't prompt for user credentials until the token expires or is revoked through VSTS/TFS.

Getting help

You can open up and report issues with the Git Credential Manager for Windows on the project GitHub. Frequently Asked Questions for the Git Credential Manager for Windows are available in the online readme.

Manual installation steps for the Windows Git Credential Manager and the macOS and Linux Git Credential Manager are available. Use these steps to install the credential manager if the recommended steps above are not suitable for your environment.

Learn more

In addition to providing full source code, we've also documented how the credential manager integrates with Git. Refer to the MSDN blog posts on the macOS and Linux Git Credential Managerand the Windows Credential Manager. There is also an article on the project GitHub with information on the low-level internals of the Git Credential Manager for Windows.

反馈

Microsoft/Git-Credential-Manager-for-Mac-and-Linux

Installation Instructions

This document explains how to obtain the Git Credential Manager for Mac and Linux (GCM4ML) and how to configure Git to use the GCM4ML as its credential helper.

System Requirements

Great care was taken to avoid using any features of Java that would impact compatibility with Java 6. If you find a compatibility issue, please report it and provide as many details about your platform as necessary to reproduce the problem.

  1. Mac OS X version 10.9.5 and up OR a recent GNU/Linux distribution.
  2. Java 6 and up.
  3. Git version 1.9 and up.

How to install

On Mac OS X, installing via Homebrew is highly recommended. On Linux, it is recommended to use Linuxbrew or an RPM-based package manager if you can.

If you can't use any of the package managers, you can also download git-credential-manager-2.0.3.jar somewhere safe and stable, such as ~/git-credential-manager/, and then follow the instructions for automatic or manual configuration.

Installing on Mac using Homebrew or on Linux using Linuxbrew (recommended)

  1. Update the Homebrew/Linuxbrew formulae to make sure you have the latest versions:

    brew update
  2. Install the GCM4ML formula:

    brew install git-credential-manager
  3. Run the GCM4ML in install mode, which will check its requirements and then update the "global" Git configuration file (the one in your home folder):

    git-credential-manager install

Installing on Linux using RPM (recommended)

  1. Download git-credential-manager-2.0.3-1.noarch.rpm and copy the file somewhere locally.

  2. Download the PGP key used to sign the RPM.

  3. Import the signing key into RPM's database:

    sudo rpm --import RPM-GPG-KEY.txt
  4. Verify the GCM4ML RPM:

    rpm --checksig --verbose git-credential-manager-2.0.3-1.noarch.rpm

    ...you should see a line (among those there) that is equal to the following:

    V4 RSA/SHA256 Signature, key ID ba34dbc2: OK
  5. Install the RPM:

    sudo rpm --install git-credential-manager-2.0.3-1.noarch.rpm
  6. Run the GCM4ML in install mode, which will check its requirements and then update the "global" Git configuration file (the one in your home folder):

    git-credential-manager install

Installing on Mac or Linux without a package manager

Download git-credential-manager-2.0.3.jar somewhere safe and stable, such as ~/git-credential-manager/

Automatic configuration (recommended)

  1. Run the GCM4ML in install mode, which will check its requirements and then update the "global" Git configuration file (the one in your home folder):

    java -jar /home/example/git-credential-manager/git-credential-manager-2.0.3.jar install

Manual configuration

  1. Configure the credential.helper setting to launch Java with the absolute path to the JAR (make sure you surround the whole value with 'single quotes'):

    git config --global credential.helper '!java -Ddebug=false -Djava.net.useSystemProxies=true -jar /home/example/git-credential-manager/git-credential-manager-2.0.3.jar'

How to enable alternate credential storage

On Linux, the GCM4ML stores credentials in the GNOME Keyring. If GNOME Keyring is unavailable for your Linux distribution, or you are running the GCM4ML via a secure shell (SSH) session, a Git setting can be used to opt into storing credentials unencrypted in a file under your home directory where presumably only you and root have read access.

To enable fallback storage of credentials in this file, run this Git configuration command:

git config --global credential.canFallBackToInsecureStore true

With this setting, the GCM4ML will fallback to storing your credentials in this file:

~/.VSTeamServicesAuthPlugin/insecureStore.xml

How to enable (or disable) debug mode

Debug mode will turn on tracing and assertions, producing a lot of output to stderr. Only turn this on temporarily, when trying to isolate a defect.

Automatic configuration (recommended)

  1. Run the GCM4ML in install mode with the debug property set to true (or false to disable):

    java -Ddebug=true -jar /home/example/git-credential-manager/git-credential-manager-2.0.3.jar install

Manual configuration

  1. Retrieve the value of the credential.helper configuration:

    git config --global --get credential.helper git-credential-manager

    ...it should look like this:

    !java -Ddebug=false -Djava.net.useSystemProxies=true -jar /home/example/git-credential-manager/git-credential-manager-2.0.3.jar
  2. Set a new value for the credential.helper configuration (essentially repeating the manual configuration installation step, being careful with quoting and spaces), changing the value of the debug property to true (or false to disable).

How to configure the proxy server

If your network does not allow a direct connection to remote hosts, you can configure the GCM4ML to perform requests through a web proxy.

Automatic configuration (recommended)

If you are running Gnome 2.x or greater, you can configure the proxy settings using the GUI and the GCM4ML will use those settings thanks to a JVM feature that's activated by setting the java.net.useSystemProxies system property to true (this is now done automatically when running the GCM4ML in install mode).

Manual configuration

If it's not possible to use the automatic proxy server configuration, you must set the appropriate networking properties. Aside from SOCKS proxy servers, which can have their credentials specified through specific properties, authenticated proxy servers are currently not supported.

  1. Retrieve the value of the credential.helper configuration:

    git config --global --get credential.helper git-credential-manager

    ...it should look like this:

    !java -Ddebug=false -Djava.net.useSystemProxies=true -jar /home/example/git-credential-manager/git-credential-manager-2.0.3.jar
  2. Set a new value for the credential.helper configuration (essentially repeating the manual configuration installation step, being careful with quoting and spaces), adding the appropriate properties. For example, if you have a proxy server that can do HTTP and HTTPS, running on the host 192.168.0.117, listening on port 8123, then you would run the following (notice there's a pair of properties for http and one for https).

    git config --global credential.helper '!java -Ddebug=false -Dhttp.proxyHost=192.168.0.117 -Dhttp.proxyPort=8123 -Dhttps.proxyHost=192.168.0.117 -Dhttps.proxyPort=8123 -jar /home/example/git-credential-manager/git-credential-manager-2.0.3.jar'

How to remove or uninstall

We are sad to see you go! Please give us some feedback on how we could do better next time.

Uninstall from Mac using Homebrew or Linux using Linuxbrew

  1. Run the GCM4ML in uninstall mode, which will update the "global" Git configuration file (the one in your home folder):

    git-credential-manager uninstall
  2. Uninstall the git-credential-manager package with Homebrew/Linuxbrew:

    brew uninstall git-credential-manager
  3. Archive the insecureStore.xml file from the git-credential-manager sub-folder under your HOME folder.

Uninstall from Linux using RPM

  1. Run the GCM4ML in uninstall mode, which will update the "global" Git configuration file (the one in your home folder):

    git-credential-manager uninstall
  2. Uninstall the git-credential-manager package with RPM:

    sudo rpm --erase git-credential-manager-2.0.3-1.noarch
  3. Archive the insecureStore.xml file from the git-credential-manager sub-folder under your HOME folder.

Automatic configuration removal (recommended)

  1. Retrieve the value of the credential.helper configuration:

    git config --global --get credential.helper git-credential-manager
  2. Run the GCM4ML in uninstall mode, which will update the "global" Git configuration file (the one in your home folder):

    java -jar /home/example/git-credential-manager/git-credential-manager-2.0.3.jar uninstall
  3. The value retrieved in step 1 contained the path to the JAR. You can go delete that JAR.

  4. Archive the insecureStore.xml file from the git-credential-manager sub-folder under your HOME folder.

Manual configuration removal

  1. Retrieve the value of the credential.helper configuration:

    git config --global --get credential.helper git-credential-manager
  2. Delete the value of the credential.helper configuration:

    git config --global --unset credential.helper git-credential-manager
  3. The value retrieved in step 1 contained the path to the JAR. You can go delete that JAR.

  4. Archive the insecureStore.xml file from the git-credential-manager sub-folder under your HOME folder.

解决:fatal: authentication failed for https的更多相关文章

  1. git——解决“fatal: Authentication failed for 'https://github.com/balabala”

    平复一下心情,到底如何在github上将队友和owner的仓库连接?如何push代码到远程仓库???找了巨多教程,终于解决了~ 刚到公司不久,开始学着用git,在提交代码的时候怎么都提不上去! 解决办 ...

  2. Username for 'https://github.com': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/GLSmile/pythontest.git/' 问题

    使用$ git push -u origin master 进行同步时,提示输入用户名和密码,但是我输入正确的信息后,仍然 会报Username for 'https://github.com': r ...

  3. remote: HTTP Basic: Access denied fatal: Authentication failed for'https'

    问题原因: 重置了密码导致git操作失败. 解决方案: 输入:git config --system --unset credential.helper 再次进行git操作,输入用户名,密码.

  4. fatal: Authentication failed for又不弹出用户名和密码 解决办法

    各位,如果能弹出来,一定是你账号密码搞错了,就别继续看了.   image.png 切换命令行:   image.png 依然报错, 说到这个问题,又可以长篇大论了, 我使用的是tortoisegit ...

  5. Git客户端执行命令报错: fatal: Authentication failed for'xxxxx.git',但是又不弹出窗口重新输入用户名和密码的解决办法

    1.Git版本:Git-2.17.0 2.引起git报错的原因 在变更远程仓库路径的的时候,弹出过一个窗口输入用户名和密码,但是输错了,之后执行任何拉取和更新的命令都会报如下的错: fatal: Au ...

  6. git [command line] fatal: Authentication failed for

    fatal: Authentication failed for https://www.jianshu.com/p/8a7f257e07b8 git.exe fetch -v --progress ...

  7. remote: Incorrect username or password ( access token ) fatal: Authentication failed for

    gitee推送到远程仓库时提示错误remote: Incorrect username or password ( access token )fatal: Authentication failed ...

  8. Git在提交代码时出现的fatal: Authentication failed的问题

    git push origin master remote: Incorrect username or password ( access token ) fatal: Authentication ...

  9. remote: http basic: access denied fatal: authentication failed for '‘解决办法

    问题描述 由于这个项目代码使用https 进行clone,为什么?因为代码库ssh有问题!fuck! 导致在push代码的时候出现了 remote: http basic: access denied ...

随机推荐

  1. 动态SQL(章节摘要)

    1,使用动态SQL能够在依赖对象不存在时创建子程序. 2.动态SQL主要利用EXECUTE IMMEDIATE语句运行DML,DDL,DCL等语句操作. 3,假设使用了绑定变量,则必须在EXECUTE ...

  2. 很不错的python 机器学习博客

    http://www.cuijiahua.com/resource.html 曾看过的书,感觉一些很有用的学习资料,推荐给大家! Python基础: 网络教程推荐: 系统学习python3可以看廖雪峰 ...

  3. 线程 Thread Runnable 守护线程 join MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  4. Spring Boot集成JasperReports生成PDF文档

    由于工作需要,要实现后端根据模板动态填充数据生成PDF文档,通过技术选型,使用Ireport5.6来设计模板,结合JasperReports5.6工具库来调用渲染生成PDF文档.本人文采欠缺,写作能力 ...

  5. 使用 AutoMapper 映射 IDataReader、DataSet、DataTable 到实体类

    AutoMapper是一个.NET的对象映射工具. 项目地址:https://github.com/AutoMapper/AutoMapper. 帮助文档:https://github.com/Aut ...

  6. MySQL数据库localhost的root用户登陆遭遇失败

    问题:Access denied for user 'root'@'localhost' (using password: YES)打开MySQL目录下的my.ini文件(Linux的话是/etc/m ...

  7. [Functional Programming + React] Provide a reasonable default value for mapStateToProps in case initial state is undefined

    For example we have a component, it needs to call 'react-redux' connect function. import { compose, ...

  8. 8个DBA最常用的监控Oracle数据库的常用shell脚本

    本文介绍了8个常用的监控数据shell脚本.首先回顾了一些DBA常用的Unix命令,以及解释了如何通过Unix Cron来定时执行DBA脚本.网上也有好多类似的文章,但基本上都不能正常运行,花点时间重 ...

  9. STL 笔记(四) 迭代器 iterator

    stl 中迭代器能够理解为面向对象版本号的广义指针,提供了对容器中的对象的訪问方法,能够遍历容器全部元素.也能够訪问随意元素.stl 迭代器有下面五种: Input iterators   仅仅读,输 ...

  10. redis 五种数据结构详解(string,list,set,zset,hash),各种问题综合

    redis 五种数据结构详解(string,list,set,zset,hash) https://www.cnblogs.com/sdgf/p/6244937.html redis 与 spring ...