1. 显示当前Git仓库的远程仓库地址
git remote -V
2. 更改Git仓库的远程仓库地址
git remote set-url origin [new-remote-url]
3. 验证是否更改成功,显示Git仓库的远程仓库地址
git remote -v
4. 将更改后的代码提交到新的远程仓库地址
git push origin master
参考:https://www.php.cn/faq/506213.html
方法二:
cd existing_repo git remote add origin http://xx.xx.xx.xx/xxx/xxxx.git git branch -M main git push -uf origin main
方法三:
创建时不要创建readme.md。这样push上来时就不会有阻碍了?或者加上-uf。强制覆盖。取消分支保护等等。
推送现有的 Git 仓库
前往您的仓库
cd existing_repo
Configure the Git repository
git remote rename origin old-origin
git remote add origin http://10.6.13.245:1880/2008nmj/basin_project_niu.git
git push --set-upstream origin --all
git push --set-upstream origin --tags
浙公网安备 33010602011771号