Given your original project on your other computer still works fine, do the following:
- Create a new folder somewhere else on your harddrive.
- Create a new git repo for it.
- Connect this new repo with your remote repo and pull the commits.
- Open this “test” project in Unity.
Does this pulled project work on your computer? If so, you can assume that the repository is fine. In that case, the problem is on the computer where the project is broken.
If the pulled project does not work on your “original” computer either, there is indeed a problem with your remote repo.
The problem with git/.gitignore is that it does not add the missing files if your repo ignored them earlier. See here.
Before messing around with your git repo, definitely do make a backup of your entire project folder on your other computer including the .git folder where the project works fine. If the .git folder is not inside your project folder, make a backup of the folder that does contain the .git folder. This way, you will also have a backup of your git history. If you accidentally destroy it, you can easily retrieve it by creating a new remote repo and push the backup to that repo.
If you cannot spot any issue in your own .gitignore, don’t replace it. There is a chance that the problem is somewhere else. Some students save their projects on their Desktop, which is a folder managed by Windows, and Windows does not always allow you to do there everything you want. It might be that the operating system deletes certain Unity files. Also do not save your project on an USB stick or in a cloud but in a normal folder on your normal internal harddrive. Make sure that no antivirus and/or firewall restricts Unity’s access rights for your project folder.
If nothing helped, duplicate your working project including the .git folder on your other computer. (If it’s broken there as well, the problem was not caused by git or your repo. In that case, the following will not help either.) Delete the .git folder inside the duplicated project folder. Then create a new git repo for this project. The initial commit is supposed to contain nothing but the linked .gitignore. The next commit should contain your entire duplicated project (minus the files that are ignored due to .gitignore). Create a new remote repo and push the duplicated project to it.
On your other computer, pull the duplicated project and test it. If it is broken as well, I’m afraid that there is a bigger issue either on your “original” computer or on the “broken” one. Typical problems are antivirus softwares such as Avast and others. They often restrict access or even delete files that are still needed.
If git does not work properly for whatever reason, a workaround that allows you to work on different computers would be to copy and paste your project onto an USB-stick whenever you are done working on it on one computer. Do not work on the USB-stick. On another device, you copy and paste the project from your USB-stick.
Ideally, you should not override your existing project but create a new folder for the pasted project. Otherwise, it might be that you override “good” files with broken files from the USB-stick. This way, you will always keep at least one backup and don’t have to rely on the USB-stick, which might contain broken files.