For convenience, sometimes Git Bash is used to execute some sh scripts, most of which are platform independent packaging and file operations. Git Bash does not carry zip packages by default. How can I use the zip command?
Install zip for Git Bash
We can manually place the zip in the Bash directory to enable Git Bash to support the zip command (similar to Linux). The following are the operation steps.
Download zip and bzip2
- visit gunwin32/zip Download the zip binary package. The latest package is
zip-3.0-bin.zip
。
- visit gunwin32/bzip2 Download the bzip2 binary package. The latest package is
bzip2-1.0.5-bin.zip
。
Unzip the bin folder
Unzip the bin folder in the above two compressed packages.
Copy zip and bzip2 programs to Git Bash
Find the usr/bin
Directory, changing zip/bin
and bzip2/bin
In folder All files Place in this directory (note that the files in the screenshot are only a part).
complete
After the operation is completed, open a Git Bash window, and you can use Git commands in Git Bash.
Other recommended solutions
If you need to use Linux frequently, you can install WSL2 with the Linux subsystem enabled, and then install Ubuntu in the Windows Store.
After installation, directly enter bash in the Powershell to enter the bash environment of the Linux subsystem at the current folder, which is very convenient.