2
votes

I'm trying to create a new repository in Azure DevOps based on an old repository also in Azure DevOps, but the transfer is not working.

The new repository is under a new project and organization. When I create it and go to Repos, I see this:

enter image description here

It seems like I have two options for importing the old repository over to this one:

  • Push an existing repository from command line.
  • Import a repository.

When I try to push an existing repository from the command line, I copy and paste the commands it gives me to the command line (PowerShell) while in the root of the project directory on my local computer (where the .git folder and .sln file are). The command is:

git remote add origin https://[email protected]/holland-and-barnes/Holland%20and%20Barnes/_git/Holland%20and%20Barnes

Running this command, it tells me:

usage: git remote add [<options>] <name> <url>

    -f, --fetch           fetch the remote branches
    --tags                import all tags and associated objects when fetching
                          or do not fetch any tag at all (--no-tags)
    -t, --track <branch>  branch(es) to track
    -m, --master <branch>
                          master branch
    --mirror[=(push|fetch)]
                          set up remote as a mirror to push to or fetch from

...and then:

git push -u origin --all

Running this command, it tells me:

Everything up-to-date
Branch 'master' set up to track remote branch 'master' from 'origin'.

And yet, back at dev.azure.com, it still says "Holland and Barnes is empty. Add some code!"

So I try the second method (importing from the old repository).

I click "Import" and it brings up the "Import a Git repository" popup:

enter image description here

I keep the repository type as Git and I enter the following for the Clone URL:

https://wardrop.visualstudio.com/Holland%20And%20Barnes/_git/Holland%20And%20Barnes

I get this directly from the Clone Repository popup of the old repository (Repos >> click on Clone):

enter image description here

I check "Requires Authentication" and enter my username and Password. I click "Import".

But it tells me in pink at the top:

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

Clone URL is incorrect.
Clone URL requires authorization

enter image description here

I am sure I'm entering my credentials properly. I copied the clone URL directly from the old repository. What else can I do?

1
Hi @gib65. Is there any update about this ticket? Feel free to let me know if the answer could give you some help. Just a remind of this.Kevin Lu-MSFT

1 Answers

2
votes

What else can I do?

The easiest way to import repo is to use import option in Azure Devops(Same as your method 2).

But from your screenshot, it seems that you are using the UserName and Password.

If yes, you could try to use PAT (Use personal access tokens).

You could grant the Full Access to the PAT and check if it could work.

On my side, if I use UserName+ Password, I get the same error message. But UserName+PAT can work fine

Another way is Git command.

You could try the following Scripts:

git clone https://xxx.visualstudio.com/Holland%20And%20Barnes/_git/Holland%20And%20Barnes

cd xxxx/xx/Holland%20And%20Barnes

git remote add origin https://[email protected]/xxx/xxx/_git/xxx

git push -u origin --all

Result:

enter image description here