可以带锚文本的网站,网站建设的技术保证怎么写,淮南发布网,投资网站实名认证可以做吗单个迁移仓库
一、迁移仓库
1.准备工作 手动在电脑创建一个临时文件夹#xff0c;CMD进入该目录 远程仓库上创建一个同名的空仓库
2.CMD命令#xff1a;拉取旧Git仓库#xff08;包含提交、分支、源码#xff09;
$ git clone --bare http://git.domain.cn/…单个迁移仓库
一、迁移仓库
1.准备工作 手动在电脑创建一个临时文件夹CMD进入该目录 远程仓库上创建一个同名的空仓库
2.CMD命令拉取旧Git仓库包含提交、分支、源码
$ git clone --bare http://git.domain.cn/path/app.git
3.CMD命令进入本地仓库目录
$ cd app.git
4.CMD命令推送仓库到新远程仓库包含提交、分支、源码
$ git push --mirror https://gitee.com/path/app.git
$ cd ..
二、更改本地项目的仓库地址
1、CMD进入本地项目文件夹不是刚才拉取的仓库目录是项目文件夹如果没有则直接从新仓库克隆项目源码到本地即可
2、CMD命令更改为新的仓库地址
$ git remote set-url origin https://gitee.com/path/app.git
以上是单个仓库的命令如需迁移多个项目可以参考下面的批量命令。 批量迁移仓库
一、Windows批量迁移Git仓库脚本(源码、分支、提交).bat
使用场景旧仓库迁移到新仓库支持所有远程Git仓库。首次运行会弹窗要求输入Git账号密码。
使用方法把此bat和remotes-all.txt文件放在一个空文件夹里双击运行。
echo offREM 旧的仓库地址
set remote_oldhttp://git.domanin.cn/git-path
REM 新的仓库地址
set remote_newhttp://gitee.com/git-path
REM 仓库名称列表手动创建一个remotes-all.txt文件多个仓库用换行隔开
set input_fileremotes-all.txtSETLOCAL DisableDelayedExpansion
FOR /F usebackq delims %%a in (findstr /n ^^ %input_file%) do (call :process %%a
)
goto :eof:process
SETLOCAL EnableDelayedExpansion
set repo!%1!
set repo!repo:*:!
echo !repo!
git clone --bare %remote_old%/!repo!.git
cd !repo!.git
git push --mirror %remote_new%/!repo!.git
cd ..
REM rmdir !repo!.git
ENDLOCAL
goto :eof 二、Windows批量切换Git本地仓库地址脚本.bat
使用场景本地已有源码不想重新克隆直接改源码的仓库地址。
使用方法把此bat和remotes-all.txt文件放在源码的上一级目录双击运行。
echo offREM 新的仓库地址
set remote_newhttp://gitee.com/git-path
REM 仓库名称列表手动创建一个remotes-all.txt文件多个仓库用换行隔开
set input_fileremotes-all.txtSETLOCAL DisableDelayedExpansion
FOR /F usebackq delims %%a in (findstr /n ^^ %input_file%) do (call :process %%a
)
goto :eof:process
SETLOCAL EnableDelayedExpansion
set repo!%1!
set repo!repo:*:!REM Check if the directory exists
if not exist !repo! (echo Directory !repo! does not exist. Skipping...goto :eof
)echo !repo!
cd !repo!
git remote set-url origin %remote_new%/!repo!.git
cd ..
ENDLOCAL
goto :eof 参考了以下博主的文章有需要的小伙伴可以戳↓
流浪_彩虹git仓库完整迁移的各种方法代码分支提交记录_git仓库迁移-CSDN博客