git-repo icon indicating copy to clipboard operation
git-repo copied to clipboard

repo init error - WindowsError: [Error 2] The system cannot find the file specified

Open danregan opened this issue 8 years ago • 10 comments

I'm trying to create a simple proof-of-concept configuration on my Windows 10 system to ensure things are working correctly. (I was able to successfully create a similar setup on an Oracle Linux 7.2 system, but I need this to work for a project that is Windows-based.) I'm using the following repo/git versions:

C:\Users\danielre\AppData\Local\Temp\git\repo>repo --ver repo version v0.4.20 (from https://github.com/esrlabs/git-repo) repo launcher version 1.25 (from C:\repo\repo) git version 2.6.4.windows.1 Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)]

C:\Users\danielre\AppData\Local\Temp\git\repo>

When I try to run "repo init", I receive the following error:

C:\Users\danielre\AppData\Local\Temp\git\repo>set REPO_TRACE=1

C:\Users\danielre\AppData\Local\Temp\git\repo> C:\Users\danielre\AppData\Local\Temp\git\repo>repo init -u file://C:\Users\danielre\AppData\Local\Temp\git\remote\manifest.git : git config --file C:\Users\danielre/.gitconfig --null --list 1>| 2>| redirecting to cat Traceback (most recent call last): File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo/main.py", line 538, in _Main(sys.argv[1:]) File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo/main.py", line 512, in _Main result = repo._Run(argv) or 0 File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo/main.py", line 181, in _Run portable.NoPager(cmd) File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo\portable.py", line 277, in NoPager RunWindowsShell(cmd) File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo\portable.py", line 281, in RunWindowsShell redirect_all(executable) File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo\portable.py", line 288, in redirect_all p = subprocess.Popen([executable], stdin=subprocess.PIPE, stdout=old_sysout, stderr=old_syserr) File "C:\Python27\lib\subprocess.py", line 711, in init errread, errwrite) File "C:\Python27\lib\subprocess.py", line 959, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified

C:\Users\danielre\AppData\Local\Temp\git\repo>

I'm not well versed in Python, but looking at the code, it appears to be trying to invoke a command prompt. I've tried from a standard command prompt, one started "as administrator", and from Git BASH, but it doesn't work (With the Git BASH shell, it gives a different error, but I'm not too concerned about it working correctly within this shell specifically -> fatal: 'C:/Program Files/Git/AppData/Local/Temp/git/remote/manifest.git' does not appear to be a git repository)

Any suggestions on what might be causing the error reported from the Windows command prompts?

danregan avatar Dec 15 '16 16:12 danregan

Hey @danregan thanks for the interest and report. Does cat work in your terminal? You see the log info "redirecting to cat" and, looking up the failing line of the project (portable.py:288) there is an issue in calling the external program. So if cat is not available, repo will not work here. You can try repo --no-pager init -u .. to verify this (this should omit the usage of cat). Thanks :).

mputz86 avatar Dec 17 '16 09:12 mputz86

Hmm… I didn't notice any mention of "cat" in the output, but I've attempted with the "--no-pager" option, and this hasn't changed the result.

C:\Users\danielre\AppData\Local\Temp\git\repo>repo init -u file://C:\Users\danielre\AppData\Local\Temp\git\remote\manifest.git %temp%\repo.no_opt 2>&1 Traceback (most recent call last): File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo/main.py", line 538, in _Main(sys.argv[1:]) File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo/main.py", line 512, in _Main result = repo._Run(argv) or 0 File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo/main.py", line 181, in _Run portable.NoPager(cmd) File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo\portable.py", line 277, in NoPager RunWindowsShell(cmd) File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo\portable.py", line 281, in RunWindowsShell redirect_all(executable) File "C:\Users\danielre\AppData\Local\Temp\git\repo.repo\repo\portable.py", line 288, in redirect_all p = subprocess.Popen([executable], stdin=subprocess.PIPE, stdout=old_sysout, stderr=old_syserr) File "C:\Python27\lib\subprocess.py", line 711, in init errread, errwrite) File "C:\Python27\lib\subprocess.py", line 959, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified

C:\Users\danielre\AppData\Local\Temp\git\repo>

In fact, the results are identical to what I receive without that option.

C:\Users\danielre\AppData\Local\Temp\git\repo>repo init -u file://C:\Users\danielre\AppData\Local\Temp\git\remote\manifest.git > %temp%\repo.no_opt 2>&1

C:\Users\danielre\AppData\Local\Temp\git\repo>repo --no-pager init -u file://C:\Users\danielre\AppData\Local\Temp\git\remote\manifest.git > %temp%\repo.no_pager 2>&1

C:\Users\danielre\AppData\Local\Temp\git\repo> C:\Users\danielre\AppData\Local\Temp\git\repo>git diff %temp%\repo.no_opt %temp%\repo.no_pager

C:\Users\danielre\AppData\Local\Temp\git\repo>

I appreciate any other suggestions you may have. Thanks!

Dan

From: Matthias Putz [mailto:[email protected]] Sent: Saturday, December 17, 2016 4:22 AM To: esrlabs/git-repo Cc: Regan, Daniel (Dan); Mention Subject: Re: [esrlabs/git-repo] repo init error - WindowsError: [Error 2] The system cannot find the file specified (#53)

Hey @danreganhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_danregan&d=DQMFaQ&c=BFpWQw8bsuKpl1SgiZH64Q&r=C2DqbUJN-9JycAZ3aw_gb6LzO3niFDaWFt36-12xmI8&m=xgUefHID-NoC61pZo9EZuRLh46Uh_woL5OOIfU6F4QQ&s=Q7BEp-J7dIyYs_cwjNulj0nTf2ZRG85XKDpiDefwHMI&e= thanks for the interest and report. Does cat work in your terminal? You see the log info "redirecting to cat" and, looking up the failing line of the project (portable.py:288) there is an issue in calling the external program. So if cat is not available, repo will not work here. You can try repo --no-pager init -u .. to verify this (this should omit the usage of cat). Thanks :).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_esrlabs_git-2Drepo_issues_53-23issuecomment-2D267752670&d=DQMFaQ&c=BFpWQw8bsuKpl1SgiZH64Q&r=C2DqbUJN-9JycAZ3aw_gb6LzO3niFDaWFt36-12xmI8&m=xgUefHID-NoC61pZo9EZuRLh46Uh_woL5OOIfU6F4QQ&s=N6F9NpAb7kiIJv08qC5kvaqMkO_ZKVDuSg2jTD2SUAc&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AXc76fH0yViik8GRggN1UCtNcQw-2DN0oLks5rI6nNgaJpZM4LORZX&d=DQMFaQ&c=BFpWQw8bsuKpl1SgiZH64Q&r=C2DqbUJN-9JycAZ3aw_gb6LzO3niFDaWFt36-12xmI8&m=xgUefHID-NoC61pZo9EZuRLh46Uh_woL5OOIfU6F4QQ&s=UaxOCUmQZkGNbgocRmIoOxcwkJCvz9PjiwCeJte0Bzw&e=.

danregan avatar Dec 19 '16 15:12 danregan

You should use the MinGW bundled with git. C:\Program Files (x86)\Git\bin is not enough on path. You have to add the C:\Program Files (x86)\Git\usr\bin as well to have the "cat" and other tools.

deeagle001 avatar Dec 22 '17 10:12 deeagle001

I have added usr\bin to the path, and played around with set GIT_CATENATE= to various settings, as well as using --no-pager. All without success.

arnonm avatar Aug 30 '18 12:08 arnonm

For me, cat built in Git doesn't work. cat from GnuWin32 works. less is also required, and Gnuwin32 has it too.

grv87 avatar Mar 21 '19 20:03 grv87

I didn't notice any mention of "cat" in the output, but I've attempted with the "--no-pager" option, and this hasn't changed the result.This is my issues: [new tag] v0.4.9 -> v0.4.9 Traceback (most recent call last): File "C:\Users\dpc\Desktop\winRepo.repo\repo/main.py", line 538, in _Main(sys.argv[1:]) File "C:\Users\dpc\Desktop\winRepo.repo\repo/main.py", line 512, in _Main result = repo._Run(argv) or 0 File "C:\Users\dpc\Desktop\winRepo.repo\repo/main.py", line 181, in _Run portable.NoPager(cmd) File "C:\Users\dpc\Desktop\winRepo.repo\repo\portable.py", line 277, in NoPag er RunWindowsShell(cmd) File "C:\Users\dpc\Desktop\winRepo.repo\repo\portable.py", line 281, in RunWi ndowsShell redirect_all(executable) File "C:\Users\dpc\Desktop\winRepo.repo\repo\portable.py", line 288, in redir ect_all p = subprocess.Popen([executable], stdin=subprocess.PIPE, stdout=old_sysout, stderr=old_syserr) File "C:\Python27\lib\subprocess.py", line 394, in init errread, errwrite) File "C:\Python27\lib\subprocess.py", line 644, in _execute_child startupinfo) WindowsError: [Error 2]

AttITuder avatar Mar 23 '19 12:03 AttITuder

Looking in the code, I see that in stable version (1.25) --no-pager option doesn't mean that cat is not used. It just changes the way it is run.

This is not true for master, there --no-pager really turns off cat.

Maybe it is a bug. But why not just install cat and be happy?

grv87 avatar Mar 23 '19 22:03 grv87

I meet the same issue, anyone has solution?

kernel-cyrus avatar Sep 15 '20 08:09 kernel-cyrus

@archman86, looks like original Google version supports Windows now. No need to use this fork.

grv87 avatar Oct 03 '20 10:10 grv87

This issue is still exists

dongpingwang avatar Oct 16 '21 10:10 dongpingwang