轉移已存在的git remote


1.如果你原本的remote 是 origin...則先改名
 vi .git/config
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/github`/*
        url = git@github.com:kk/test.git
      
==>
[remote "github"]
        fetch = +refs/heads/*:refs/remotes/github`/*
        url = git@github.com:kk/test.git
 


2.增加一各 remote
git remote add origin git@gitweb.sw1.net:kernel8006.git
 
3.查看config
 vi .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "github"]
        fetch = +refs/heads/*:refs/remotes/github`/*
        url = git@github.com:kk/test.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "origin"]
        url = git@gitweb.kk.net:test2.git
        fetch = +refs/heads/*:refs/remotes/origin/*


4.上傳到新的remote


git push --all


 



 

創作者介紹
創作者 立你斯 的頭像
立你斯

立你斯學習記錄

立你斯 發表在 痞客邦 留言(0) 人氣()