0

I have cloned my Git repo and opened the project in VS Code. After a couple of minutes, VSCode-Source Control shows a couple of files as Deleted. If I try to discard the files as I don't need to push these changes, I get the VS Code error:

Git: Unable to create file

VSCode - Source Control

VSCode - Source Control

Error message

Error message

I tried cloning the repo and each time these files showed up.

How should I fix this?

I tried discarding the files but was not able to. This same works totally fine on my other laptop.

I have also tried running the long path command support but still the same:

git config --global core.longpaths true
Azeem
  • 11,148
  • 4
  • 27
  • 40
SanJay
  • 1
  • 2
  • Are you by chance missing a path(s) in your `.gitignore` and those files are being deleted as part of a run task? – Parker Mar 14 '23 at 00:31
  • I dont think so there is any in the .gitignore file. Same repo works fine in my other laptop. – SanJay Mar 14 '23 at 01:06
  • do both your laptops have the same version of vs code? Can you provide exact steps to reproduce the issue with a fresh new repo? – starball Mar 14 '23 at 01:07
  • Yes both laptop has same ver of VSCode. Do you mean to create a new git repo and then clone? Steps: -Clone the repo using Git Desktop -Open the project folder using VSCode -Checkout your feature branch -Make some changes, commit and push your changes -Wait for sometime -Deleted files will show up in Souce Control tab – SanJay Mar 14 '23 at 02:53
  • 1
    Is the directory into which you cloned the repo synched to the Cloud? – j6t Mar 14 '23 at 06:36
  • 1
    Yes the folder in on Onedrive. – SanJay Mar 14 '23 at 14:07
  • 3
    That is a big, BIG, ***BIG*** no-no. Don't do that. It hurts. Onedrive will destroy your repository in no time. – j6t Mar 14 '23 at 21:28
  • 1
    Try cloning outside of OneDrive folder. Related reading: [Is it dangerous to put git directory in drive sync tool](https://stackoverflow.com/q/69056041/2745495) – Gino Mempin Mar 20 '23 at 11:12

0 Answers0