My client has started migrating their various repos from GitHub to Azure DevOps. Goal is to get everything into DevOps before the end of the year. Whenever we create a new project, we add it to DevOps instead of GitHub, and for existing GitHub repos, we make an import using the DevOps tooling.
Imports work just fine. However, a couple of weeks back I added two new projects to DevOps. I've since then had to delete the local files due to some rearranging on my local drive. Now, when I try to clone these projects, I cannot for the life of me get the actual files to download using the "standard" workflow, namely:
- Start Visual Studio (2019 Community in this case)
- Chose Clone a repository
- Browse the Azure DevOps repositories
- Select the repo in question and click Clone
This works for the repos I imported from GitHub, but not for the ones I created from scratch in Azure DevOps. I can see the files in DevOps, they're all there, but cloning doesn't result in what I regard to be the expected behavior. At first glance, it looks like something is downloaded, and this is the output I get in Visual Studio:
Cloning into 'C:\Users\ ..... \LegacyUnsubscriptionExecutor'...
POST git-upload-pack (164 bytes)
Remote: Azure Repos
Remote:
Remote: Found 101 objects to send. (207 ms)
Opening repositories:
C:\Users\ ..... \LegacyUnsubscriptionExecutor
No errors in sight. But the actual folder on the C drive in this case is empty except for the .git folder, .vs folder, and a Readme.md. No solution files, no .gitignore, no folder with the project files.
I've tried various things to resolve this based on what little information I could find on SO, such as:
- Using the Visual Studio Installer to install Git for Windows
- Downloading Git for Windows and installing it manually
- Installed latest version of Git Credentials Manager
- Removed DevOps credentials from the Windows Credentials store
None of that had any noticable effect. The only thing that seems to work is to use Git CMD and issuing the following commands:
$ git fetch origin master
From https://dev.azure.com/ ..... /_git/LegacyUnsubscriptionExecutor
* branch master -> FETCH_HEAD
$ git reset --hard FETCH_HEAD
HEAD is now at 2414731 .....
The second command populates the folder in question with the proper files, and I'm then forced to do a Force Push from Visual Studio because I've got divergent branches.
I haven't had to use Git CMD to clone a repository for the last couple of years. Surely this shouldn't be required, but for some reason it is in this case. Why? What am I missing? What does the fact that I have to do a hard reset indicate, in terms of the configuration of these particular repos?
2414731
appears to have the changes. Immediately after the clone, what branch and commit are you on? Comparegit log
andgit log origin/master
to see if they are different.