1. 程式人生 > >Eclipse提交專案到GitHub上

Eclipse提交專案到GitHub上

說明:高版本eclipse開發工具自帶Git外掛(免安裝)

  1. 檢視eclipse是否已安裝git外掛
    window->preferences
    team-git
    檢視是否有git配置項;
    不存在請安裝後操作哦!
  2. 上傳本地工程
    右擊”專案名稱”->Team->share project… ->select a repository type:Git,如下圖所示
    倉庫型別我們選擇Git

  3. 建立本地倉庫
    3.1 Creation of repositories in the Eclipse workspace is not recommended
    警告:不建議在Eclipse工作區中建立儲存庫
    這裡寫圖片描述


    3.2 點選create按鈕,我們自己建立一個.git檔案倉庫
    這裡寫圖片描述
    3.3 勾選要上傳的工程專案如下圖
    這裡寫圖片描述
    Path winth repository 為倉庫內檔案,建議創業一個本專案的父級檔案,便於後期管理整潔!
    點選完成功能按鈕,本地倉庫建立成功。
    3.4 此時回到工程,專案會如下所示,檔案前面會出現‘?’字樣,代表著要被提交哦
    這裡寫圖片描述

  4. 上傳工程程式碼到本地倉庫
    右鍵”專案名稱”->Team->Commit (Ctrl+#)
    這裡寫圖片描述
    說明:Author:使用者名稱 <郵箱>(提交者的使用者名稱和郵箱)
    Committer: 使用者名稱 <郵箱>
    commmit 完成本地倉庫上傳操作!

  5. 上傳工程程式碼到遠端github倉庫
    輸入目的地倉庫位置Enter the location of the destination repository.
    5.1 Location位置
    URI:遠端倉庫路徑
    Host:github.com:根據自動填入
    Repository path:根據uri自動填入
    5.2 Connecton連線
    Protocal:選擇傳輸協議為https
    Port:不用填
    5.3 Authenticaton認證
    User:遠端倉庫使用者名稱
    Password:遠端倉庫密碼
    Store in Secure Store 儲存密碼
    這裡寫圖片描述

  6. 配置push規則
    6.1 選擇 source ref:refs/heads/master
    6.2 點選+Add Spec
    6.3 在Specifications for push
    勾選Force Update(強制更新到github倉庫中)
    這裡寫圖片描述
    finish

  7. 推送結果 push result
    這裡寫圖片描述

  8. 登入github檢視
    這裡寫圖片描述
    恭喜,完成!