2016-05-03 69 views
0

我想將git庫還原到脫機VM(Debian)。我可以通過我可以訪問互聯網的本地計算機(Mac)進入離線虛擬機。我怎樣才能將git repo克隆到該離線虛擬機?將git庫回覆到脫機機器

簡單地將repo文件夾scp到VM目錄的工作原理?像:

local_machine$ git clone https://github.com/rstudio/shiny-server.git 

local_machine$ scp ~/shiny-server VM_machine: 

local_machine$ ssh VM_machine: 

VM_machine$ mv ~/shiny-server ~/workspace 

請幫忙。

+1

你嘗試了嗎? –

+0

@Oliver我試過了。然而,由於這個回購只是依賴的一部分,並且需要時間來實際運行整個事情。我只想知道我是否在正確的軌道上。:) –

回答

0

你可以clone從本地計算機在虛擬機庫:

VM_machine$ git clone local_machine:~/shiny-server ~/workspace 

Reference: The SSH Protocol

+0

我明白你的觀點。但是,我必須通過兩層SSH才能訪問我的虛擬機。像:local_machine - > ssh VM_machine1 - > ssh VM_machine2。我應該如何克隆到第二臺虛擬機? –

+0

也許這樣?:'VM_machine2 $ git clone VM_machine1:〜/ workspace〜/ workspace' – whoan

+0

謝謝!所以,我運行「local_machine $ git clone https://github.com/rstudio/shiny-server.git」來將repo克隆到我本地的第一個。然後,我將第一條命令作爲「VM_machine1 $ git clone local_machine:〜/ shiny-server〜/ workspace」運行,將repo複製到machine1上的「〜/ workspace」目錄。最後,我運行「VM_machine2 $ git clone VM_machine1:〜/ workspace/shiny-server〜/ workspace」,將rep1再次從machine1複製到machine2的目錄「〜/ workspace」。我解釋了嗎? –