github 远程仓库名或地址修改,本地如何同步
2023-09-11 14:17:57 时间
1. 背景
远程服务器迁移,服务器IP改变;或者远程仓库名变更,导致本地仓库失效。如何在原有仓库的基础上让本地仓库和新的远程仓库建立关联。
例如:
本地git项目目录为:SingTel/
本地添加的远程仓库名为:origin
旧的远程仓库地址:https://github.com/wuyihao1992/SingTel-demo.git
新的远程仓库地址:https://github.com/wuyihao1992/SingTel.git
2. 大致有下面几种方法
方法一 通过命令直接修改远程地址:
1. 进入 SingTel/ 根目录
2. git remote 查看所有远程仓库, git remote xxx 查看指定远程仓库地址(如:xxx为origin)
3. git remote set-url origin https://github.com/wuyihao1992/SingTel.git
方法二 通过命令先删除远程仓库再添加远程仓库:
1. 进入 SingTel/ 根目录
2. git remote 查看所有远程仓库, git remote xxx 查看指定远程仓库地址
3. git remote rm origin
4. git remote add origin https://github.com/wuyihao1992/SingTel.git
方法三 直接修改配置文件:
1. 进入 SingTel/.git 目录
2. vim config
3. 修改 [remote “origin”]下面的url即可
相关文章
- 怎样使用github
- Git的使用--如何将本地项目上传到Github
- 本地项目通过github客户端上传到github网站上
- github 大文件上传
- 为毛Github的contributions贡献值不增长了
- EasyDarwin开源社区 短视频拍摄项目Github地址
- 你知道什么是 GitHub Action 么?
- 利用Travis CI 让你的github项目持续构建(Node.js为例)
- android 当在github下载一个android项目后
- 什么是Github的元数据metadata以及如何备份github上的数据
- 搭建一个免费的,无限流量的Blog----github Pages和Jekyll入门
- 什么是Github的元数据metadata以及如何备份github上的数据
- 用nodejs读取github上某仓库的某条issue明细
- 30天进阶Python,这个 Github 项目你值得拥有!
- python登陆github
- Python:OAuth2第三方登录之Github
- github同步、更新fork过来的代码
- 出现“Could not resolve host: www.github.com; Unknown error”错误解决
- 【Github教程】史上最全github用法:github入门到精通
- GitHub上传文件夹及Git命令
- 【基础知识】11、github上传本地代码
- Android的报错提示:Failed to resolve: com.github.bumptech.glide:glide:4.9.0
- github page搭建自己的页面