V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Sliverburger
V2EX  ›  问与答

Git 的 SSH URL 什么时候变成不需要 ssh:// 的了?有什么办法批量修改么?

  •  
  •   Sliverburger · 2017-07-28 01:43:40 +08:00 · 2274 次点击
    这是一个创建于 2457 天前的主题,其中的信息可能已经有所发展或是发生改变。

    可能是火星了,前两天还用的好着呢 最近安装了个 SourceTree,不知道是不是更新了 Git 的版本还是怎么回事

    git pull / git push 无法使用了 !!!!

    提示:

    ssh: Could not resolve hostname github.com:angular: nodename nor servname provided, or not known
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    然后研究了一下,主要是 git 对于远程 URL 配置部分好像是改了,以前是这样:

    [remote "origin"]
    	url = ssh://[email protected]:angular/angular.git
    	fetch = +refs/heads/*:refs/remotes/origin/*
    	pushurl = ssh://[email protected]:angular/angular.git
    

    现在是这样:

    [remote "origin"]
      url = [email protected]:Yelp/elastalert
      fetch = +refs/heads/*:refs/remotes/origin/*
    

    不确定是不是 pushrul 不需要了,但可以确定的是 ssh:// 这部分不需要了? (谁能解释下这是新版这样的?还是说老版这样的?用 brew 安装的是 2.13.3

    那么现在主要问题就来了,有什么办法批量修改这部分的东西么?本地有大约 30 多个 repo 都需要更新

    2 条回复    2017-07-29 02:05:39 +08:00
    msg7086
        1
    msg7086  
       2017-07-28 01:49:18 +08:00   ❤️ 1
    我记得我一直用的是 [email protected]:name/repo 这样的格式啊。

    批量修改的话 sublime 不行吗,Find all files 功能。
    sed in place 也行。
    Sliverburger
        2
    Sliverburger  
    OP
       2017-07-29 02:05:39 +08:00
    @msg7086 好吧谢谢,最后写了个 sed 改好了
    我也不知道以前为什么有 ssh:// 可能是 clone 的太早了吧
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1367 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 17:30 · PVG 01:30 · LAX 10:30 · JFK 13:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.