Git迁移单个项目

2 阅读1分钟

1.clone原有项目到本地

git clone --bare https://原仓库地址.git old-repo.git 
cd old-repo.git

2.添加新仓库作为推送远端,新仓库全新,避免“HEAD”等冲突

# 删除旧远端(可选) 
git remote remove origin 
# 添加新仓库地址 
git remote add new-origin https://新仓库地址.git

3.推送本地所有分支

git push new-origin --all

4.推送所有标签

git push new-origin --tags