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

Git克隆后目标文件夹为空的原因分析及解决办法

问题原因及解决方法

原因

你初始化repocentral仓库后,创建的hello/hello.txt文件并没有被Git追踪和提交。Git克隆的是仓库中已完成提交的版本内容,空仓库克隆后自然生成空的dev1文件夹。

解决方法

按以下步骤将文件提交到原仓库,再重新克隆:

  1. 回到repocentral目录,将文件加入Git追踪:
cd repocentral
git add hello/hello.txt
  1. 提交变更到本地仓库:
git commit -m "add hello.txt"
  1. 再次执行克隆命令,dev1文件夹就会包含hello目录及其中的hello.txt文件:
git clone repocentral dev1

注意:后续新增或修改文件后,都需要执行git add和git commit操作,才能让变更被Git记录,进而通过克隆同步到其他副本。

内容的提问来源于stack exchange,提问作者lê bá thắng

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 17:27:33