Git Bash displays strange characters in Windows 7

I installed Gitbash on my Windows and defined Linux command lines (e.g. ls to display the directory), but strange characters appear on the command line.

Reginaldo@Dell MINGW64 /c/dev/php/laravel/flamboyant (master) $ php artisan ←[32mLaravel Framework←[39m version ←[33m5.1.29 (LTS)←[39m ←[33mUsage:←[39m command [options] [arguments] ←[33mOptions:←[39m ←[32m-h, --help←[39m Display this help message ←[32m-q, --quiet←[39m Do not output any message ←[32m-V, --version←[39m Display this application version ←[32m --ansi←[39m Force ANSI output ←[32m --no-ansi←[39m Disable ANSI output ←[32m-n, --no-interaction←[39m Do not ask any interactive question ←[32m --env[=ENV]←[39m The environment the command should run under. ←[32m-v|vv|vvv, --verbose←[39m Increase the verbosity of messages: 1 for norm al output, 2 for more verbose output and 3 for debug ←[33mAvailable commands:←[39m ←[32mclear-compiled←[39m Remove the compiled class file ←[32mdown←[39m Put the application into maintenance mode ←[32menv←[39m Display the current framework environment ←[32mhelp←[39m Displays help for a command ←[32minspire←[39m Display an inspiring quote ←[32mlist←[39m Lists commands ←[32mmigrate←[39m Run the database migrations ←[32moptimize←[39m Optimize the framework for better performance ←[32mserve←[39m Serve the application on the PHP development ser ver ←[32mtinker←[39m Interact with your application ←[32mup←[39m Bring the application out of maintenance mode ←[33mapp←[39m ←[32mapp:name←[39m Set the application namespace ←[33mauth←[39m ←[32mauth:clear-resets←[39m Flush expired password reset tokens ←[33mcache←[39m ←[32mcache:clear←[39m Flush the application cache ←[32mcache:table←[39m Create a migration for the cache database table ←[33mconfig←[39m ←[32mconfig:cache←[39m Create a cache file for faster configuration loa ding ←[32mconfig:clear←[39m Remove the configuration cache file ←[33mdb←[39m ←[32mdb:seed←[39m Seed the database with records ←[33mevent←[39m ←[32mevent:generate←[39m Generate the missing events and listeners based on registration ←[33mhandler←[39m ←[32mhandler:command←[39m Create a new command handler class ←[32mhandler:event←[39m Create a new event handler class ←[33mkey←[39m ←[32mkey:generate←[39m Set the application key ←[33mmake←[39m ←[32mmake:command←[39m Create a new command class ←[32mmake:console←[39m Create a new Artisan command ←[32mmake:controller←[39m Create a new resource controller class ←[32mmake:event←[39m Create a new event class ←[32mmake:job←[39m Create a new job class ←[32mmake:listener←[39m Create a new event listener class ←[32mmake:middleware←[39m Create a new middleware class ←[32mmake:migration←[39m Create a new migration file ←[32mmake:model←[39m Create a new Eloquent model class ←[32mmake:policy←[39m Create a new policy class ←[32mmake:provider←[39m Create a new service provider class ←[32mmake:request←[39m Create a new form request class ←[32mmake:seeder←[39m Create a new seeder class ←[32mmake:test←[39m Create a new test class ←[33mmigrate←[39m ←[32mmigrate:install←[39m Create the migration repository ←[32mmigrate:refresh←[39m Reset and re-run all migrations ←[32mmigrate:reset←[39m Rollback all database migrations ←[32mmigrate:rollback←[39m Rollback the last database migration ←[32mmigrate:status←[39m Show the status of each migration ←[33mqueue←[39m ←[32mqueue:failed←[39m List all of the failed queue jobs ←[32mqueue:failed-table←[39m Create a migration for the failed queue jobs dat abase table ←[32mqueue:flush←[39m Flush all of the failed queue jobs ←[32mqueue:forget←[39m Delete a failed queue job ←[32mqueue:listen←[39m Listen to a given queue ←[32mqueue:restart←[39m Restart queue worker daemons after their current job ←[32mqueue:retry←[39m Retry a failed queue job ←[32mqueue:subscribe←[39m Subscribe a URL to an Iron.io push queue ←[32mqueue:table←[39m Create a migration for the queue jobs database t able ←[32mqueue:work←[39m Process the next job on a queue ←[33mroute←[39m ←[32mroute:cache←[39m Create a route cache file for faster route regis tration ←[32mroute:clear←[39m Remove the route cache file ←[32mroute:list←[39m List all registered routes ←[33mschedule←[39m ←[32mschedule:run←[39m Run the scheduled commands ←[33msession←[39m ←[32msession:table←[39m Create a migration for the session database tabl e ←[33mtracker←[39m ←[32mtracker:tables←[39m Create the migrations for Tracker database table s and columns ←[33mvendor←[39m ←[32mvendor:publish←[39m Publish any publishable assets from vendor packa ges ←[33mview←[39m ←[32mview:clear←[39m Clear all compiled view files Reginaldo@Dell MINGW64 /c/dev/php/laravel/flamboyant (master) 

Can anybody help me?

+7
git linux bash
source share
3 answers

For MingGW64, I found a transition in Options> Terminal and switching from xterm (by default I suppose) to xterm-256color fixed the problem. I also restarted the console.

enter image description here

+7
source share

You need to activate ansi control code processing. See here for more details.

Jason carns in a shell

Using git on windows for more than three years, I fell in love with the command line again. Bash, of course, is not on the Windows command line. Beautiful, ubiquitous, warty bash. git is heavily dependent on GNU utilities, so on Windows it requires either cygwin or msys. Having been burned by cygwin in the past, I prefer the minimalism and simplicity of msys + mingw. Along with git, the entire ruby ​​ecosystem lives in a shell. However, numerous tools, gems, and utilities that accept the standard ANSI color support in the shell began to be worn on me. And so, there is a great solution to support ansi color support for bash (and cmd) on Windows: ansicon.

Download zip and extract . There are several installation methods:

  • Extract to a permanent location (I use C: / bin / ansicon). Run ansicon.exe -i from the appropriate directory of your system (x86 / x64), and you will install everything. Any new shells (bash and Windows cmd are included) will authorize the ansicon utility to display color output. Be sure not to move the executable file before running ansicon.exe -u. This removes the registry entry and prevents the ugly error message for each shell.

  • Alternatively, put the ansicon executable in your PATH or add its location in PATH . You can then start ansicon for the session with ansicon.exe –p .

This utility works fine for me on Windows XP. I had problems with its work in Windows 7, but I heard that it should be supported. If you solve a problem with Windows 7, post an error message.

Update

The root cause is uncovered ! If you use JRuby with a 64-bit JVM on Windows x64, ansicon will not work. The problem is that ansicon (64-bit) is able to inject into 32-bit processes, but not vice versa. The JRuby launcher is currently a 32-bit executable. Thus, if you use a 64-bit shell (cmd, Bash or otherwise), ansicon will correctly enter this process. It will then be successfully integrated into the 32-bit JRuby startup process. At the moment, for all purposes and tasks, you are using the 32-bit version of ansicon. Thus, if you run JRuby on a 64-bit JVM, then 32-bit ansicon cannot inject into a 64-bit JVM. There is an open function request for JRuby to send its 64-bit version with a 64-bit launcher. You must vote for this feature. I also heard that adoxa (Jason Hood) has a potential issue for this issue at work. Stay in touch.

Of course, the easiest solution at the moment is to ensure that JRuby uses a 32-bit JVM. Just change (or set) your JAVA_HOME environment variable to point to the 32-bit JVM and youre golden.

Update 2: issue resolved

The latest 64-bit binaries (ansi6432.zip) fixed the problem. Just download and extract them over version 1.51.

enter image description here

+6
source share

I do not remember the latest version of GIT. I encountered the same problem after updating Git Bash to 2.11.

Decreasing to 2.10 solved my problem. https://github.com/git-for-windows/git/releases/tag/v2.10.0.windows.1

+2
source share

All Articles