• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

卢晓春的博客

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

Gitlab Runner windows环境下解决中文乱码导致无法拉取含有中文的tag

环境

  • 系统 windows10
  • CPU架构AMD64
  • gitlab版本: GitLab Enterprise Edition 13.12.0-ee
  • gitlab runner版本: 17.10.1

失败现象

fatal: couldn't find remote ref refs/tags/浣犵殑

Running with gitlab-runner 17.10.1 (ef334dcc)
  on dev-gaoyu Chob-M8t, system ID: s_172a3486fe3d
Preparing the "shell" executor
00:00
Using Shell (powershell) executor...
Preparing environment
00:00
Running on MYPC...
Getting source from Git repository
00:01
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in C:/gitlabtest/.git/
fatal: couldn't find remote ref refs/tags/浣犵殑
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 128

解决方法

在执行启动gitlab runner服务之前,先切换代码页

chcp 65001
./gitlab-runner.exe run

网上其它方法(失败)

  • 在gitlab runner的config.toml中 增加 pre_clone_script = "chcp 65001"
  • 在.gitlab-ci.yml的script中增加 "chcp 65001"

个人理解

似乎在Reinitialized existing Git repository这一步就出错了,此时还没有机会运行chcp 65001命令
通过先执行 chcp 65001 再启动gitlab runner,可以避免顺序问题

posted on 2025-04-08 13:03  卢晓春  阅读(81)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3