Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: open /dev/null or dup failed: No such file or directory

I am new here and i will try to explain my question kindly ignore any mistakes.

I am using git version git-2.8.2 It worked fine for one day then this problem occurs. I am using gcloud repository. First I tried gcloud clone command then this error occurs enter image description here

Then to make sure git is there I tired git command then this error occursenter image description here

Then I double check by opening git Bash but same error was there too. enter image description here

I tried reinstalling changing directory. but nothing works.

like image 345
Yasir Ijaz Avatar asked May 06 '16 10:05

Yasir Ijaz


4 Answers

I face the same problem after I try to avoid memory leak in Windows 10. If you happened to change the regedit like me, just type regedit in the search then go to

HKEY_LOCAL_MACHINE -> SYSTEM -> ControlSet001 -> Services -> Null

change the value of Start to 1.

like image 119
Jingyu Bao Avatar answered Nov 12 '22 03:11

Jingyu Bao


I accidentally bumped into the same problem when I was sorting out the services running on my computer with Windows 10.

fatal: open /dev/null or dup failed: No such file or directory

The reason was that I deleted the service named 'Null' that had no description as I thought that was a virus service.

enter image description here

Thus, when I found my git unable to operate, I reckoned the deleted service. According to a solution provided on some site I tried to run the service again using cmd.exe

sc config Null start= system
sc start Null

but it said the service hadn't been existed in the list. Thankfully, there are some kind folks who shares the information of the default services running on Windows 10 and the description necessary for the successful bringing back the service.

So as to get the service back in the list:

  1. press Win + R
  2. type regedit
  3. go to HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services section
  4. Create Null folder and all the params it needs.

enter image description here

  1. Restart your computer.
  2. Now you got your Null service back and your git back as well.

enter image description here

Hope this helps.

like image 45
Григорий Avatar answered Nov 12 '22 04:11

Григорий


I solved my problem accidentally. I would like to share it with everyone. It was not a problem of git or gcloud or source tree.

Actually I have forcefully stooped windows update from installing which causes this problem. Now when I install windows updates again this problem is fixed now. Maybe this helps someone.

like image 21
Yasir Ijaz Avatar answered Nov 12 '22 04:11

Yasir Ijaz


the similar situation in chrooted linux tree is fixable following way:

cd inside the folder where you are preparing the chroot dir, then

mount -o bind /dev dev/

then only chroot inside

like image 38
Oleg Kokorin Avatar answered Nov 12 '22 05:11

Oleg Kokorin