'Clone URL is incorrect' when importing from GitHub to Azure DevOps
Asked Answered
R

9

37

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: Import error and input parameters

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?

Randarandal answered 20/2, 2020 at 13:50 Comment(4)
Has the problem been resolved? The suggestions i posted should help resolve it. If you still facing the issue, please feel free to tell and follow or you can accept my answer if it helps. Thanks!Ostwald
@YangShen-MSFT I ended up just copy and paste-ing the project to the folder of the other repository, then pushing it to DevOps. I can neither confirm nor deny that the solution you provided works :) I am not sure what to do with this question.Randarandal
Never mind, the most important thing is to solve the issue. Glad to know the issue is gone. Have a nice day :)Ostwald
I have also been unable to resolve this error despite trying 2x password resets, and have ended up proceeding with manual approach as reported by OP.New
S
48

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. 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.

  2. 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.

  3. 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

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

Stalemate answered 15/8, 2021 at 12:0 Comment(4)
The steps for setting the PAT were all I needed. I gave "repo" and "user" permissions, copied the key, and the import worked without a problem after that.Hartzog
Same here, I only needed to create a PAT and it works. Thanks!Rosin
Thank you! Generating the token worked for me too. Been pulling my hair out for over a day with this oneMohave
Thanks so much @BrandonPetty!!! Yes, you not only need to create a PAT, you absolutely need to check the "repo" and "user" permissions. Also make sure to copy the token.Eutectoid
R
21

I found the solution!

  1. In your GitHub account, go to your icon in the top right corner and then click on Settings

  2. In the left sidebar, click on Developer settings

  3. Then in the left sidebar again, click on Personal access tokens

  4. Click the button Generate new token

  5. Give the token a name, e.g. 'Move to Azure'

  6. Set the Expiration to however long you need it to be for your move

  7. Under Select scopes, tick repo

  8. Click on the green button labeled: Generate token

  9. Copy your token (save it in a password safe if you have multiple repos)

  10. In Azure, paste it into the field Password / PAT

  11. After you've moved all repositories, don't forget to delete your Personal Access Token from GitHub

Ruysdael answered 16/1, 2022 at 20:52 Comment(2)
This problem occurs because GitHub disabled password authentication on 31 August 2021.Ruysdael
Note that in step #3 Personal access tokens is now in the Developer settings sidebar itemValentinvalentina
S
11

I just recognized "Generate Git Credentials" does the trick!

In your source repos, you must "Generate Git Credentials" enter image description here

In your dest repos where you click import use the "Clone Url" from source and enter the generate Git credentials!

Sean answered 9/1, 2021 at 16:25 Comment(5)
That is not for GitHub to Azure DevOps, right?Taraxacum
Thank you ! This worked like a charm My goal was to move a repo from a project to another in the same organizationChevy
This answer refers to cloning an Azure DevOps repo to somewhere else. It does not belong to this topic.Roller
This worked for me. My case does NOT involve GitHub. I am importing a git repo built in Azure DevOps to another repo still in Azure DevOps (but different project).Tice
Yes this is the procedure for Az. DevOps Project-> DevOps Project. Worked like a charm when I was left wondering which user/password I should be providing (seeing as my Az user is the owner of everything). +1Fiddlewood
O
6

I've tested the Import a Git repository in sevral situations: public or private Github repo, with or without access in PAT and with or without file in Github repo.

Only in two cases i can reproduce the problem:

enter image description here

  1. No file exists in the Github repo, if there's nothing in the Github repo, seems the url https://github.com/****/*****.git can not be recognized successfully.

    In this case, you need to upload at least one any file into the repo and the url will be recognized then.

  2. Wrong PAT, we copy PAT from one place to another, there might be unexpected characters included, such as a space.

    In this case, you need to check the PAT by click the little eye icon in the input textbox, delete or add characters to make it correct.

    enter image description here

Ostwald answered 21/2, 2020 at 7:51 Comment(0)
D
3

This should be the answer:
you must provide your User Name. The aeterisk * is missing though

Doubtless answered 20/11, 2021 at 22:5 Comment(0)
U
2

For me, it was because the GitHub repo I wanted to copy was Private.

Make it Public* and try again.

  1. Go to the GitHub repo you want to import, on the Settings's page change the visibility to Public.
  2. Copy the .git (HTTPS) URL of the repo.
  3. On Azure, paste the link and click on Import.
  • WARNING: Please be aware of the implications of making your repo public.

My GitHub repo Settings' page

Ugrian answered 30/1, 2021 at 20:51 Comment(1)
This should be a recommendation without explaining the security implication in my opinion. :/Taraxacum
B
1

I had the same issue when trying to import a private repository. I had missed a step when setting a Personal Access Token (Github > Settings > Developer Settings > Fine-grained tokens). I had selected "All repositories" in the Repository Access section, but didn't realise I also needed to set "Repository permissions" in the Permissions section. I now have this: Repository access where "Contents" is set to Read-only access: Read-only access to Contents (Metadata is also set to Read-only when the above is set)

Without setting Permissions, the PAT reverts to "Public Repositories (read-only)". It's also possible to edit existing PATs, so easy to check if permissions are correctly set.

Balbinder answered 5/12, 2022 at 12:3 Comment(0)
S
0

I get this message even if I want to copy a Repos from the same Account from another project. No chance! I am wondering why the Clone URL refers to a "*.git" file? If I take the "Clone Repos URL" from the source repos, there is no ".git" at the end.

Sean answered 9/1, 2021 at 16:19 Comment(0)
S
0

i ran into same issue it worked when i enter my exact Github username and PAT. While creating PAT, make sure to select github scopes: repo and projects.

Submerged answered 9/2, 2023 at 18:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.