2022-06-07 工作记录--Git-查看远程仓库 + 添加远程仓库 + 删除远程仓库

发布时间:2024-08-28 10:01

一、查看远程仓库

1、命令行 ⭐️

git remote -v

2、举例

【如下:其中的origin为其仓库的别名】

$ git remote -v
origin http://gitlab2.test.com/yanghui/dev-v1.git (fetch)
origin http://gitlab2.test.com/yanghui/dev-v1.git (push)

二、添加远程仓库

1、命令行 ⭐️

git remote add 仓库别名(自定义) 仓库地址

2、举例

【添加仓库别名为origin2的仓库】

$ git remote add origin2 http://gitlab2.test.com/yanghui/dev-v2.git

【然后 查看远程仓库】

$ git remote -v
origin http://gitlab2.test.com/yanghui/dev-v1.git (fetch)
origin http://gitlab2.test.com/yanghui/dev-v1.git (push)
origin2 http://gitlab2.test.com/yanghui/dev-v2.git (fetch)
origin2 http://gitlab2.test.com/yanghui/dev-v2.git (push)

三、删除远程仓库

1、命令行 ⭐️

git remote rm 仓库别名(已存在滴)

2、举例

【删除上面新添加的仓库别名为origin2的仓库】

git remote rm origin2

【然后 查看远程仓库】

$ git remote -v
origin http://gitlab2.test.com/yanghui/dev-v1.git (fetch)
origin http://gitlab2.test.com/yanghui/dev-v1.git (push)

\"在这里插入图片描述\"

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号