是有3個選項
選項1.什麼你已經做了(最合理的選擇)。 將SVN中的兩個項目轉換爲2個獨立的Git存儲庫。 然後使用GitLab,Atlassian Bitbucket Server或任何其他Git服務器軟件設置對存儲庫的訪問權限。
選項2.將整個SVN存儲庫視爲單個目錄。
subgit configure --svn-url <svn_server>/SVN-Repo --layout directory C:\GitRepos\SVN-Repo\repo.git
subgit install C:\GitRepos\SVN-Repo\repo.git
然後你可以運行
subgit uninstall C:\GitRepos\SVN-Repo\repo.git
如果你不需要連續同步。在這種情況下,Git倉庫將植根於SVN-Repo。
選項3.一個Git存儲庫,包含兩個項目的分支。
subgit configure --svn-url <svn_server>/SVN-Repo C:\GitRepos\SVN-Repo\repo.git
然後編輯repo.git/subgit/config
設置
trunk = Project1/trunk:refs/heads/project1-master
branches = Project2/trunk:refs/heads/project2-master
branches = Project1/branches/*:refs/heads/project1-*
branches = Project2/branches/*:refs/heads/project2-*
shelves = shelves/*:refs/shelves/*
tags = Project1/tags/*:refs/tags/project1-*
tags = Project2/tags/*:refs/tags/project2-*
然後運行
subgit install C:\GitRepos\SVN-Repo\repo.git
然後你可以運行
subgit uninstall C:\GitRepos\SVN-Repo\repo.git
如果你不需要連續同步。
在這種情況下,您有1個Git存儲庫,其中包含與您的項目對應的project1-
和project2-
的分支。您也可以使用project1/
/project2/
而不是project1-
/project2-
。
因此,根據您的需要,您可以選擇其中一種選項,但第一種選擇是最好的選擇。
你想達到什麼結果(我不明白「git clone」+「git push」命令)?您使用的命令在'C:\ GitRepos \ SVN-Repo \ Project1.git'創建了一個Git倉庫,這不是您想要的嗎?你不需要設置Git服務器來服務Project1.git –
我想在GIT中具有與在SVN中相同的結構。 GIT repo中的含義:2個子文件夾Project1和Project2與主...因爲當我推動Project1時,它位於回購站的根目錄,而不是位於名爲Project1的文件夾中 – Didier
這就是Git的工作原理:存儲庫由分支,分支有一個擁有自己的子樹的樹(文件夾)等等。分支不能包含在子樹內。但有一種方法可以將整個存儲庫翻譯爲2個項目作爲目錄(不推薦)或者分支到''refs/heads//*'或'refs/heads/ - *'branchnames(這也不會如果這些項目沒有關係,那麼這很有意義)。所以你做了什麼,是最合理的做法。 –