3 回答

TA貢獻1863條經(jīng)驗 獲得超2個贊
創(chuàng)建一個新的 Maven 項目(無論你想創(chuàng)建它)。當然,這將在文件系統(tǒng)中創(chuàng)建一個包含所有資源的新目錄。
從命令行(位于項目目錄內(nèi))執(zhí)行
git init
. 這將在該目錄中創(chuàng)建本地存儲庫。接下來,將遠程添加到您的本地存儲庫:(
$ git remote add origin https://github.com/user/repo.git
可選地替換origin
為您的遠程存儲庫將被調(diào)用的名稱,也替換user
為您的 github 用戶名和repo
您的 github 存儲庫名稱的名稱)在本地存儲庫中添加所有要提交的文件。
例如
$ git add . # Adds the file to your local repository and stages it for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
提交更改。
例如:
$ git commit -m "Add existing file" # Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
請清楚,以以下結(jié)構(gòu)作為參考,我建議將任何目錄project1
, project2
,用作 git 存儲庫projectN
,而不是整個 worspace (/roo_dir/workspace/
目錄)。
/roo_dir/workspace/ - project1 - project2 - projectN

TA貢獻1816條經(jīng)驗 獲得超6個贊
試試這個
在 git hub 中創(chuàng)建一個空白項目
在本地創(chuàng)建maven項目
克隆 git 倉庫
這不會有任何文件
復制maven項目
將文件添加到 git 并推送

TA貢獻1871條經(jīng)驗 獲得超8個贊
最后,我做了以下事情:
我在 github 本地存儲庫的目錄中創(chuàng)建了一個帶有原型的新 Maven 項目。
我使用 github 應用程序在同一目錄中創(chuàng)建了具有相同名稱的存儲庫。
然后我將這個存儲庫發(fā)布到github。
現(xiàn)在我將項目從github本地倉庫導入到eclipse中。
工作流程通常是@lealceldeiro 建議的工作流程,但不使用命令行 git。
添加回答
舉報