2011年1月23日 星期日

git 更改遠端資訊 的指令

為了轉移到新的伺服器,git 的 repository 要搬到新位置,所以 local 端的 repository 指標要換掉,下列指令依序就是轉換的步驟:

#> git remote -v
顯示目前指向哪些遠端的 repository? (URL 格式)

#> git remote rm origin
移除 URL 資訊

#> git remote add origin git@git-server:project_name
改變 URL 資訊,指向新位置 (若是用 gitosis ,就可以直接建立新的遠端 repository ,否則遠端的新增的 repository 必須先用 git init 或 git init --bare 處理過)
(目前為止,都還沒有對 remote repository 產生任何影響)

#> git push origin master
把 local repository 更新到 remote 端(這裡,才實際的更新了 remote repository)

沒有留言:

張貼留言