英文:
Azure DevOps and Git Fetch Failed With Error
问题
我已经创建了Azure DevOps流水线,但在进行git checkout时失败。
但是,如果我在任何命令行中运行相同的命令,它可以正常工作。
我选择了MAC并且它可以正常工作,但在Windows上显示错误。
英文:
I have created Azure DevOps pipeline but it is failing on git checkout,
Starting: Checkout repository@Dev to s
==============================================================================
Task : Get sources
Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version : 1.0.0
Author : Microsoft
Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Syncing repository: repository (ExternalGit)
Prepending Path environment variable with directory containing 'git.exe'.
git version
git version 2.39.1.windows.1
git lfs version
git-lfs/2.13.3 (GitHub; windows amd64; go 1.16.2; git a5e65851)
git init "D:\a\s"
Initialized empty Git repository in D:/a/1/s/.git/
git remote add origin http://gitlab.mycompany.net/mycompany/myapp.git
git config gc.auto 0
git config --get-all http.http://gitlab.mycompany.net/mycompany/myapp.git.extraheader
git config --get-all http.extraheader
git config --get-regexp .*extraheader
git config --get-all http.proxy
git config http.version HTTP/1.1
git remote set-url origin http://***:***@gitlab.mycompany.net/mycompany/myapp.git
git remote set-url --push origin http://***:***@gitlab.mycompany.net/mycompany/myapp.git
git fetch --force --no-tags --prune --prune-tags --progress --no-recurse-submodules origin
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See http://gitlab.mycompany.net/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'http://gitlab.mycompany.net/mycompany/myapp.git/'
##[warning]Git fetch failed with exit code 128, back off 6.062 seconds before retry.
git fetch --force --no-tags --prune --prune-tags --progress --no-recurse-submodules origin
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See http://gitlab.mycompany.net/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
But if I run the same command in any command line it is working fine,
C:\Users\Imran\repo>git version
git version 2.32.0.windows.2
C:\Users\Imran\repo>git lfs version
git-lfs/2.13.3 (GitHub; windows amd64; go 1.16.2; git a5e65851)
C:\Users\Imran\repo>git init
Initialized empty Git repository in C:/Users//Imran/repo/.git/
C:\Users\Imran\repo>git remote add origin http://gitlab.mycompany.net/mycompany/myapp.git
C:\Users\Imran\repo>git config gc.auto 0
C:\Users\Imran\repo>git config --get-all http.http://gitlab.mycompany.net/mycompany/myapp.git.extraheader
C:\Users\Imran\repo>git config --get-all http.extraheader
C:\Users\Imran\repo>git config --get-regexp .*extraheader
C:\Users\Imran\repo>git config --get-all http.proxy
C:\Users\Imran\repo>git config http.version HTTP/1.1
C:\Users\Imran\repo>git remote set-url origin http://username:pass@gitlab.mycompany.net/mycompany/myapp.git
C:\Users\Imran\repo>git remote set-url --push origin http://username:pass@gitlab.mycompany.net/mycompany/myapp.git
C:\Users\Imran\repo>git fetch --force --no-tags --prune --prune-tags --progress --no-recurse-submodules origin
warning: redirecting to https://gitlab.mycompany.net/mycompany/myapp.git/
remote: Enumerating objects: 54107, done.
remote: Counting objects: 100% (1844/1844), done.
remote: Compressing objects: 100% (138/138), done.
I have selected MAC and it works but with Windows its showing error.
答案1
得分: 2
我发现当我复制GitLab仓库的URL时,它包含了http。我将URL更改为https,然后它就可以正常工作。
英文:
I have found that when I copy gitlab repo URL, it includes http. I changed the URL to https and it worked.
答案2
得分: 0
使用 HTTPS 而不是 HTTP 从 GitHub 到 Azure 拉取 Git 仓库。
英文:
use https instead of http while fetching git repositories from github to azure.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论