从 GitHub 导入到 Azure DevOps 时出现“克隆 URL 不正确" [英] 'Clone URL is incorrect' when importing from GitHub to Azure DevOps

查看:19
本文介绍了从 GitHub 导入到 Azure DevOps 时出现“克隆 URL 不正确"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 GitHub 存储库导入 Azure DevOps,但我不断收到此错误:

I am trying to import a GitHub repository to Azure DevOps and I keep getting this error:

Import request cannot be processed due to one of the following reasons:

Clone URL is incorrect.
Clone URL requires authorization.

这是我输入参数的截图:

Here is a screenshot of my input parameters:

我对克隆 url 和身份验证参数进行了两次和三次检查.无论我在字段中输入什么,它总是显示这两个错误.我怎样才能解决这个问题?

I have double and triple checked the cloning url and the authentication parameters. No matter what I put into the fields it always displays these two errors. How can I trouble shoot this?

推荐答案

尝试将组织管理的私有 GitHub 存储库全新导入到我的新 Azure DevOps 帐户时遇到了同样的问题(即使我的帐户是我试图链接的 GitHub 和 Azure DevOps 配置文件的所有者).

Got the very same problem when trying to make a fresh new import of a private GitHub repo managed by an Organization to my new Azure DevOps account (even though my account is the owner of both GitHub and Azure DevOps profiles I was trying to link).

三个步骤实际上帮助我解决了这个问题:

Three steps actually helped me to resolve it:

  1. 通过 Azure DevOps 链接两个帐户 >您的项目 >项目设置 >GitHub 连接.如果您的 GitHub 存储库存储在组织配置文件中,您在此处必须确保在您设置时授予对该组织的访问权限在 Azure DevOps 中建立连接(在 Azure DevOps 中标识的组织配置文件旁边会有一个小的授予按钮,你必须按下它才能真正授予访问权限).在我的情况下,我错过了它并且连接不起作用(Azure DevOps 在 GitHub 配置文件中找不到任何存储库).为了解决这个问题,我必须点击 GitHub 发送给我的自动电子邮件中的链接,并在那里授予对 Azure DevOps 的访问权限.然后在 Github >您的组织 >组织设置 >第三方访问您将能够在列表中看到 Azure DevOps - 如果状态为已批准,您就可以开始了.

  1. Link two accounts via Azure DevOps > your project > Project Settings > GitHub connections. If your GitHub repo is stored in an Organization profile, here you have to make sure that you grant access to this Organization while you're setting up the connection in Azure DevOps (there will be a small Grant button next to the identified Organization profile in Azure DevOps, you have to press it to actually grant the access). In my case I missed it and the connection did not work (Azure DevOps couldn't find any repos in the GitHub profile). To resolve this, I had to follow the link from an automatic e-mail sent to me by GitHub and grant access to Azure DevOps there. Then in Github > your organization > Organization Settings > Third-party access you will be able to see Azure DevOps in the list - if the status is Approved, you're good to go.

然后我必须在 GitHub 中为我的个人资料(不是组织资料)创建 PAT,并在我在 Azure DevOps 中导入存储库时使用它而不是密码(非常感谢 @Yang上面指出这一点的沉).这样你首先得去Github >您的个人资料 >配置文件设置 >开发者设置 >个人访问令牌并在那里生成一个新令牌.

Then I had to create a PAT for my personal profile in GitHub (NOT the Organization profile) and use it instead of the password when I was importing the repo in Azure DevOps (big thanks to @Yang Shen who pointed this out above). This way you first have to go to Github > your profile > Profile Settings > Developer Settings > Personal access tokens and generate a new token there.

然后我回到 Azure DevOps >您的项目 >回购文件 >导入,放入:a) 链接到我的私人 Github 存储库;b) 勾选需要身份验证";c) 我的 GitHub 用户名;d) 我在上面第 2 步中生成的 PAT 而不是我的实际密码

Then I returned to Azure DevOps > your project > Repos > Files > Import, putting in: a) Link to my private Github repo; b) Tick "Authentication required"; c) My GitHub username; d) My PAT generated at Step 2 above instead of my actual password

然后它就像一个魅力,我的私人 Github 存储库被克隆到 Azure 存储库.

Then it worked like a charm, my private Github repo was cloned to Azure Repos.

这篇关于从 GitHub 导入到 Azure DevOps 时出现“克隆 URL 不正确"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆