39 lines
1.0 KiB
Plaintext
39 lines
1.0 KiB
Plaintext
# Windows 上传项目到 Gerrit - 快速命令
|
||
|
||
## 前提
|
||
- 项目路径: D:\zhini\zhini_im
|
||
- Gerrit 地址: http://101.43.95.130:8080
|
||
- 项目名称: zhini_im
|
||
|
||
## 在 Git Bash 中执行以下命令:
|
||
|
||
# 1. 进入项目目录
|
||
cd /d/zhini/zhini_im
|
||
|
||
# 2. 检查是否已有 Git 仓库
|
||
ls -la | grep .git
|
||
|
||
# 3. 如果没有,初始化 Git 仓库
|
||
git init
|
||
git add .
|
||
git commit -m "Initial commit"
|
||
|
||
# 4. 配置 Git 用户信息(如果还没配置)
|
||
git config user.name "admin"
|
||
git config user.email "admin@example.com"
|
||
|
||
# 5. 添加 Gerrit 远程仓库
|
||
git remote add gerrit http://101.43.95.130:8080/zhini_im
|
||
|
||
# 6. 推送代码到 Gerrit(首次上传)
|
||
git push gerrit HEAD:refs/heads/master
|
||
|
||
# 或者推送到评审队列(推荐用于后续更新)
|
||
git push gerrit HEAD:refs/for/master
|
||
|
||
## 注意事项:
|
||
1. 如果提示需要用户名密码,用户名填 "admin",密码留空
|
||
2. 如果项目已存在,可能需要先拉取:git pull gerrit master --allow-unrelated-histories
|
||
3. 推送成功后,在 Gerrit Web 界面查看项目
|
||
|