git 仓库迁移
在目标服务器建立新的git 功能仓库
[git@VM-0-5-centos ~]$ git init --bare stm32f103c8t6-ota-4g.git
Initialized empty Git repository in /home/git/stm32f103c8t6-ota-4g.g/
git远程仓库地址(设置仓库源时会用到)
格式:用户@域名或ip:仓库路径
例子:这里是:git@tx.XXXX.cn:/home/git/stm32f103c8t6-ota-4g.git
设置git 仓库源
用git remote set_url 更换地址(修改本地仓库所关联的远程仓库的地址)
格式:git remote set-url origin remote_git_address
例子:git remote set-url origin git@tx.XXXX.cn:/home/git/stm32f103c8t6-ota-4g.git
上传代码
与git 上传代码一致
git add .
git commit -am ""
git push
验证是否成功
克隆远程仓库项目,与原工程内容对比,一致则说明git 仓库迁移成功。
git clone git@tx.XXXX.cn:/home/git/stm32f103c8t6-ota-4g.git
git远程仓库地址查看
git remote -v
origin git@tx.XXXX.cn:/home/git/stm32f103c8t6-ota-4g.git (fetch)
origin git@tx.XXXX.cn:/home/git/stm32f103c8t6-ota-4g.git (push)