2013-03-26 78 views
1

我想將我的github.com/username/reponame推送到我的實時網絡服務器domain.com/demo/。我已經設法正確地將代碼推送到該位置,但它包括我的回購的頂級目錄,將文件放入domain.com/demo/reponame/推送到服務器時避免Git回購頂部文件夾?

我對Git和SSH非常陌生,我不理解我應該如何推/拉,因此我的GitHub倉庫的頂級文件夾不包含在內。

答案:必須將git clone [email protected]:username/reponame.git更改爲git clone [email protected]:username/reponame.git . - 該段末尾忽略頂層文件夾。

+0

'git'會拉你有'git commit'ed。所以,你可以'git commit'只有一個特定的路徑或文件,然後'git push'。所以不要使用'git commit -a' – 2013-03-26 22:25:21

+0

我做了以下操作: 通過SSH登錄服務器上的文件夾,然後: git clone [email protected]:username/reponame.git – 2013-03-26 22:39:17

回答

0

要添加到你的答案,我寧願克隆作爲裸回購:

git clone --bare [email protected]:username/reponame.git /a/path/different/from/reponame 

(這裏沒有最終點),爲了能夠: