文章目录

最近把自己的服务器丢到了办公室,配了新的IP(这种事简直作死),
原来在上面的git server当然要继续用下去。。嗯,手上的N个项目怎么办呢。

很简单,百度可知有三种方法可以迁移git repo.

  1. 修改命令

    1
    git remte origin set-url URL
  2. 先删后加

    1
    2
    git remote rm origin 
    git remote add origin git@github.com:foo/bar.git
  3. 直接修改config文件
    git的配置文件位于/.git/config,用notepad++修改即可

    1
    [remote "origin"]
    	url = http://username@github.com:port/path/to/foobar.git
    	fetch = +refs/heads/*:refs/remotes/origin/*

ok,搞定,愉快地撸代码去啦

文章目录