git怎么更换推送链接
时间: 2024-05-19 15:06:14 浏览: 59
更换 Git 推送链接的步骤如下:
1. 查看当前 Git 推送链接
在终端输入以下命令:
```
git remote -v
```
会显示当前 Git 远程仓库的推送和拉取链接,类似于以下输出:
```
origin https://github.com/username/repo.git (fetch)
origin https://github.com/username/repo.git (push)
```
2. 删除当前 Git 推送链接
在终端输入以下命令:
```
git remote rm origin
```
这将删除名为 origin 的远程仓库链接。
3. 添加新的 Git 推送链接
在终端输入以下命令:
```
git remote add origin https://github.com/new-username/new-repo.git
```
将新的远程仓库链接添加到名为 origin 的远程仓库中。
4. 验证新链接
在终端输入以下命令:
```
git remote -v
```
将会显示新的 Git 远程仓库链接,类似以下输出:
```
origin https://github.com/new-username/new-repo.git (fetch)
origin https://github.com/new-username/new-repo.git (push)
```
现在你已经成功更换了 Git 推送链接。
阅读全文