You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用git p4 clone克隆Perforce depot报错:无法运行p4

问题描述

执行git p4 clone //depot/systems@all克隆Perforce仓库时报错:

Initialized empty Git repository in /folder/folder/.git/
Perforce client error:
p4 -h for usage.
Invalid option: -r.
failure accessing depot: could not run p4

执行p4 depots能正常看到仓库信息:

Depot systems 2010/12/03 local systems/... 'Created by user. '

环境为RH 9.4 + Python 3.9,已执行p4 login,Perforce的同步、添加、编辑操作均正常,但git-p4无法工作。添加verbose参数后,错误日志显示git-p4尝试执行p4 -r 3 -G login -s,但-r选项不被当前p4客户端支持。

问题分析与解决

核心原因是当前Perforce客户端版本过旧,不支持-r(重试次数)命令行参数,而git-p4默认会读取git-p4.retries配置(默认值3),并将其作为-r参数传递给p4命令,导致报错。

解决方法有两种:

  • 临时规避:执行以下命令关闭git-p4的重试功能,避免生成-r参数:
    git config --global git-p4.retries 0
    
    之后重新执行git p4 clone //depot/systems@all即可。
  • 根本解决:升级Perforce客户端到支持-r参数的版本(建议升级到2019.1及以上版本,该版本开始引入-r重试参数)。

内容的提问来源于stack exchange,提问作者user25471220

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 16:38:14