I came across this issue a few times with different developers so I thought I will write about it to save time for others. When you think about it then there's nothing wrong or mysterious about it but you may end up spending lots of time on it without realising what's wrong.
If you create a new repository with a whitespace, like My repository then when you clone it:
git clone my.visualstudio.com/DefaultCollection/_git/My%20repository
It will create a new folder with the name My%20repository
Everything is correct here, you can't have a space in an URL but if you open the solution in visual studio and build it you'll get errors like:
The remote server returned an error: (401) Unauthorized or This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.
The simplest solution is to rename the folder by removing %20 or set a name when you clone it, like
git clone [url] [Name]
As I said, this is not an issue but easy to miss if you don't pay attention. Next time when you can't restore NuGet packages, start with checking where the repository was cloned.