下最小正確流程(全部用絕對路徑,不依賴當前目錄。
一、初始化(只做一次)
mkdir -p /home/ubuntu/chromium_120
cd /home/ubuntu/chromium_120
#(可選)網絡穩定性
git config --global http.version HTTP/1.1
git config --global core.compression 0
git config --global http.postBuffer 524288000
#(可選)代理
export http_proxy=http://127.0.0.1:17888
export https_proxy=http://127.0.0.1:17888
二、拉代碼(關鍵:不要 -j)
cd /home/ubuntu/chromium_120
fetch --nohooks --no-history chromium
👉 結果應有:
/home/ubuntu/chromium_120/src
三、第一次依賴同步(可並發)
cd /home/ubuntu/chromium_120
gclient sync -j12 --nohooks --no-history
四、切到 Chromium 120(正確方式)
❗ 不要用 git fetch --tags
cd /home/ubuntu/chromium_120/src
git fetch origin refs/branch-heads/6099:refs/remotes/origin/6099
git checkout -b chromium120 origin/6099
五、對齊 120 的依賴(必要)
cd /home/ubuntu/chromium_120
gclient sync -j12 --nohooks --no-history
六、(可選)精確到某個 patch(例如 120.0.6099.71)
👉 如果你一定要精確版本:
cd /home/ubuntu/chromium_120/src
# 查 commit(可用 git log 或官方對照)
git log --oneline | grep 6099
然後:
git checkout <commit_id>
cd ..
gclient sync -j12 --nohooks --no-history
七、驗證狀態
cd /home/ubuntu/chromium_120/src
git log -1
八、核心規則(避免再踩坑)
✔ 可以用 -j 的地方
gclient sync -j12
ninja -j12
❌ 不能用 -j
fetch ❌
git fetch ❌
❌ 禁止操作(會炸)
git fetch --tags # 會拉幾十GB歷史
九、整體流程(極簡版)
fetch → gclient sync → checkout branch-heads → gclient sync
一句話總結
用
fetch拿骨架
用gclient補依賴
用branch-heads定版本
👉 不要碰--tags