github 远程仓库名或地址修改,本地如何同步

it2022-05-05  188

1.背景

github远程仓库名变更,导致本地仓库失效。如何在原有仓库的基础上让本地仓库和新的远程仓库建立关联。

假设:

本地git项目目录为:testGit/    本地添加的远程仓库名为:origin    旧的远程仓库地址:https://github.com/yohayoha/testGit1.git    新的远程仓库地址:https://github.com/yohayoha/testGit.git

2.方法

方法一 直接修改远程地址

进入testGit/ 根目录git remote 查看所有远程仓库:git remote xxx查看指定远程仓库地址(ps:此处的xxx为origin)修改旧仓库地址为:git remote set-url origin https://github.com/yohayoha/testGit.git查看地址是否已修改:git remote -v

方法二 先删除远程仓库再添加远程仓库

进入testGit/ 根目录git remote 查看所有远程仓库, git remote xxx 查看指定远程仓库地址git remote rm origingit remote add origin https://github.com/yohayoha/testGit.git

方法三 修改配置文件

进入 testGit/ 根目录vim config修改[remote "origin"] 下面的url地址

转载于:https://www.cnblogs.com/Ponchien/p/11174229.html

相关资源:各显卡算力对照表!

最新回复(0)