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

如何避免git-sync同步时路径中生成提交哈希子文件夹?

解决git-sync路径中包含提交哈希的问题

要避免git-sync生成带提交哈希的子文件夹,直接调整命令参数即可:

  • 添加--no-hash参数:这个选项会禁用默认的哈希子目录生成逻辑,让代码直接同步到你指定的--dest路径下。

修改后的完整命令如下:

git-sync --repo https://dev.azure.com/..../repo \
--root /tmp/git/data --dest data --one-time \
--branch master --max-sync-failures 5 \
--password-file /opt/.git-sync-pass --add-user true --depth 1 --no-hash

原理很简单:git-sync默认会用提交哈希创建子目录来区分不同版本的同步结果,加上--no-hash后,就会直接把内容同步到data目录下,不再生成哈希子文件夹。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.02 21:28:09