【git命令】修复问题: "remote-origin-already-exists-error"

git remote系列命令

 显示所有远程仓库:

git remote -v

以下我们先载入远程仓库,然后查看信息

$ git clone https://github.com/tianqixin/runoob-git-test
$ cd runoob-git-test
$ git remote -v
origin  https://github.com/tianqixin/runoob-git-test (fetch)
origin  https://github.com/tianqixin/runoob-git-test (push)

 origin 为远程地址别名

 

显示某个远程仓库的信息

git remote show [remote]

例如:

$ git remote show https://github.com/tianqixin/runoob-git-test
* remote https://github.com/tianqixin/runoob-git-test
  Fetch URL: https://github.com/tianqixin/runoob-git-test
  Push  URL: https://github.com/tianqixin/runoob-git-test
  HEAD branch: master
  Local ref configured for 'git push':
    master pushes to master (local out of date)

 

添加远程版本库:

git remote add [shortname] [url]

shortname 为本地的版本库,例如:

# 提交到 Github
$ git remote add origin git@github.com:tianqixin/runoob-git-test.git
$ git push -u origin master

 

其他相关命令:

git remote rm name  # 删除远程仓库
git remote rename old_name new_name  # 修改仓库名

 

参考资料

1. What "Remote Origin Already Exists" Error Means and How To Fix It"

What "Remote Origin Already Exists" Error Means and How To Fix It

posted @ 2020-09-26 16:42  苏格拉底的落泪  阅读(90)  评论(0编辑  收藏  举报