git - 如何更改 VSCode 中的远程源?

标签 git visual-studio-code

VS Code 是我所有项目的实际 IDE 和 git 客户端。 我想更改实际存储库的源远程。

我该怎么做?

最佳答案

它可以通过终端完成。 (VS code有终端)

  1. 转到目录的根目录。

  2. 列出您现有的 Remote 以获得您想要更改的 Remote 的名称。

    $ git remote -v
    origin  git@github.com:USERNAME/REPOSITORY.git (fetch)
    origin  git@github.com:USERNAME/REPOSITORY.git (push)
    
  3. 使用 git remote set-url 命令将远程的 URL 从 SSH 更改为 HTTPS。

    $ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
    
  4. 验证远程 URL 是否已更改。

    $ git remote -v
    origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
    origin  https://github.com/USERNAME/REPOSITORY.git (push)
    

关于git - 如何更改 VSCode 中的远程源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51979534/

相关文章:

javascript - 无法使用 Debugger for Chrome 在 Visual Studio Code 中放置断点

来自 github 空绿色文件夹的 Git 存储库

visual-studio-code - 如何重置 Visual Studio Code 中的设置?

git - GIT 的名称不明确?

git - 是否可以在 Gitlab(或其他 Git 存储库管理工具)中公开特定分支?

visual-studio-code - WSL2 密码提示中 VS Code 上的远程 SSH

docker - 将 WSL VSCode 扩展连接到安装在 Windows 中的 docker

visual-studio-code - VS Code 的扩展如何获取 VS Code 的安装路径?

linux - GIT 服务器的硬件要求(RHEL linux)

git - 如何设置 ssh key 以绕过 git bash 密码提示