12

I am receiving the error message below in the command prompt when using the git init command. I'm using a Windows PC running Windows 7.

C:\rails_projects\first_app>git init
'chcp' is not recognized as an internal or external command,
operable program or batch file.
Reinitialized existing Git repository in C:/rails_projects/first_app/.git/
'chcp' is not recognized as an internal or external command,
operable program or batch file.

I'm new to Ruby on Rails and I'm trying to create a repository for my Rails project. When I use a command such as rails new first_app or rails server I don't receive the message, only when I used the git init command does it show up. Also, as you can see the command still functions correctly (i.e. Reinitialized existing Git repository in C:/rails_projects/first_app/.git/), however, it's annoying to see the error message every time I make a command.

Does anyone have any idea how to fix this problem? I found a link that told me I need to switch the console to Windows-1252 http://illegalargumentexception.blogspot.com/2009/04/i18n-unicode-at-windows-command-prompt.html#charsets_1252 but that didn't work.

I appreciate any help, thanks!

Abundnce10
  • 2,150
  • 3
  • 26
  • 41
  • 1
    This doesn't have anything to do with rails, so I'm going to edit your tags. This is only regarding Git on windows. – Jesse Wolgamott Nov 15 '11 at 19:37
  • Git also have nothing common with broken environment variables – Lazy Badger Nov 15 '11 at 21:36
  • 2
    Note that in the special case of XP64, the error messages can occur despite having the correct PATH entries. more info: http://code.google.com/p/msysgit/issues/detail?id=358 – prusswan Jan 20 '12 at 20:14

5 Answers5

24

See if your PATH environment variable is setup properly. Any system should have atleast the below on PATH

;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;

Add the above if not there.

Once added, open a new cmd / bash and try:

where chcp

It should give the path.

Then try with the git init again

Edit

If you need help to find where to add it enter image description here

Raphaël Balet
  • 6,334
  • 6
  • 41
  • 78
manojlds
  • 290,304
  • 63
  • 469
  • 417
  • Manojlds statement of the PATH ;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem was already in the environment variable;. However, I still had the same problem. After some analysis, the problem was solved by modifying the batch file where the python program was pointing. In this batch file, above must be in the PATH environment. – user1161829 Nov 17 '17 at 20:16
1

I copied the file from windows/system32 into the Vmware CLI/bin directory which resolved it for me.

Gary Scott
  • 11
  • 1
1

You have broken PATH (check with SET PATH), chcp is internal Windows-command, which can be found in $Windows\system32\ dir

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
0

Go to \RailsInstaller\Git\cmd then open the git (command prompt file) with a text editor or word pad (by right clicking the file and selecting edit) now there would be two lines which would look like

@chcp %cp_ansi% > nul < nul 

and

@chcp %cp_oem% > nul < nul

delete both of them, and save the file . This should resolve the problem

0

Looks like this same issue. The link has some ideas on how to fix it. In the link, the issue was created by Git being installed standalone, and with rails.

Andy
  • 44,610
  • 13
  • 70
  • 69