Braise
Braise

Reputation: 43

Can't push to new repo : The folder pushed differ in case

Before diving in the question, a little background:

A couple months ago, my team migrate our repo from Team Foundation Server to Azure DevOps. Last week, we noticed that one branch on the TFS had work done on it which is now needed. So we decided to bring that branch to Azure in order to avoid doing the said work again.

I cloned the repo from TFS on my machine, change the url of origin to match the one of Azure and then tried to push the branch with the following steps :

  1. Clone from TFS
  2. Create a new branch from the branch I'm interested in
  3. Add a remote origin (called origin-azure)
  4. Add a dummy file and committed the change
  5. Push the branch to origin-azure

It gave me the following error message :

error: remote unpack failed: error The tree object 1234 was rejected: The folder 'myfolder' and the folder 'MyFolder' pushed differ in case. You must remove or rename one of them or disable case-enforcement (see https://aka.ms/git-platform-compat). To https://urlOfRepoOnAzure ! [remote rejected] ExportBranche -> ExportBranche (The tree object 5678 was rejected: The folder 'myfolder' and the folder 'MyFolder' pushed differ in case. You must remove or rename one of them or disable case-enforcement (see https://aka.ms/git-platform-compat).) error: failed to push some refs to https://urlOfRepoOnAzure

I deleted the folder "myfolder" and tried again. Same error. But I'm able to push to TFS wihtout any problems at all.

I don't understand what's going on. Especially why the push to Azure is rejected since I'm pushing a new branch.

Upvotes: 2

Views: 6079

Answers (2)

WaitingForGuacamole
WaitingForGuacamole

Reputation: 4301

I agree with @BernardoDuarte that you should be able to change the policy about case enforcement, but if it's not working, I would try to get out of the way of the whole conflict by doing a more manual update:

  1. Clone the TFS repo into a brand new folder
  2. Checkout the branch you wish to migrate from (A)
  3. Clone the Azure DevOps repo into a different brand new folder
  4. Create a topic branch (B)
  5. Copy all of the folders EXCEPT myFolder from (A) to (B)
  6. Open myFolder in (A), and copy all of its contents to myFolder in (B)
  7. git status in (B) to make sure that the folder case of myFolder is the same as it is in the Azure DevOps repo.
  8. Commit and push your topic branch to (B)
  9. Pull request your topic branch in Azure DevOps, and then complete it.

If you overwrite myFolder itself, Git will track that as a change and try to push it. This approach, while admittedly clumsy, prevents that change from ever happening, and should bypass the issue.

Upvotes: 1

Bernardo Duarte
Bernardo Duarte

Reputation: 4264

You can try following this link and change your repository settings on Azure Repos regarding your Policies about Case enforcement.

Upvotes: 1

Related Questions