git-修改远程的URL

来源:互联网 发布:nba总决赛数据2016 编辑:程序博客网 时间:2024/05/22 03:05

git remote set-url命令修改remote URL

git remote set-url传递两个参数

  • remote name。例如,origin或者upstream
  • new remote url。例如,git@github.com:USERNAME/OTHERREPOSITORY.git

 

例如:从SSH切换到HTTPS的远程URL

  1. 打开终端
  2. 切换到你项目的工作目录
  3. 列出remotes,是为了得到你想要改变的remote的名字
    xxxxxx@xxxxxx:~/workspace/goal$ git remote -vorigin    git@github.com:xxxxxx/SpringBoot.git (fetch)origin    git@github.com:xxxxxx/SpringBoot.git (push)
  4. 使用git remote set-url命令从SSH到HTTPS的远程URL
    xxxxxx@xxxxxx:~/workspace/goal$ git remote set-url origin https://github.com/xxxxxx/SpringBoot.git
  5. 验证是否改变成功
    xxxxxx@xxxxxx:~/workspace/goal$ git remote -vorigin    https://github.com:xxxxxx/SpringBoot.git (fetch)origin    https://github.com:xxxxxx/SpringBoot.git (push)
出处:http://www.cnblogs.com/yandufeng/p/6423821.html
原创粉丝点击