commitizen / cz-cli

The commitizen command line utility. #BlackLivesMatter
http://commitizen.github.io/cz-cli/
MIT License
16.9k stars 552 forks source link

The config file at "C:\Users\lenovo\.czrc" contains invalid charset, expect utf8 #949

Open wdianjun opened 2 years ago

wdianjun commented 2 years ago

安装使用git commit规范 使用命令git cz 为什么会报这个错误?求解

Zhengqbbb commented 2 years ago

utf8!!!删除根目录下的.czrc,在vscode中新建.czrc文件

{ "path": "cz-git" }

https://cz-git.qbb.sh/zh/guide/#%E5%85%A8%E5%B1%80%E4%BD%BF%E7%94%A8

bsor-dev commented 2 years ago

+1

odGit commented 2 years ago

The issue is not with commitizen, but with CLI (in my case PowerShell) it was not setting utf-8 encoding of the .czrc file. I have had the same issue on Windows 10 in PowerShell (PSVersion: 5.1.19041.1682).

The following solved the encoding issue for me:

'{ "path": "cz-conventional-changelog" }' | Add-content -Encoding UTF8 -Path ~/.czrc

Note: I am using commitizen as a global utility with the .czrc file in the "root" directory.

simon1uo commented 10 months ago

使用 vscode 编辑一下,保存的时候修改成 utf8 编码格式就好了