git仓库迁移

git仓库代码迁移

1. 拉取原仓库git代码

git clone 原仓库地址url

2. 拉取原仓库所有的分支到本地

git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch 
git pull

3. 修改.git目录下的config文件

[core]
	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	symlinks = false
	ignorecase = true
[remote "origin"]
	url = 你的远程地址  #修改这里的地址(实际文件里不要加上这条注释)
	fetch = +refs/heads/*:refs/remotes/origin/*

4. 推送master分支(要求输入密码)

git push -u origin master

5.推送所有分支

git push --all

只是修改远程仓库地址

git remote set-url origin 远程仓库地址
原文地址:https://www.cnblogs.com/steven158/p/15545385.html