--- title: 'Eclipse Git 操作' disqus: hackmd --- ###### tags: `Git` `Eclipse` Eclipse Git 操作 === [TOC] ## 筆記目的 了解如何使用Eclipse Git 操作 適用的場景,有個本地端的project想要把它新增到gitlab上去做版控 ## 先備條件 已經有了gitlab或是github 並且在Eclipse上裝了git擴充 ## 第一步:將專案建立local的repository 專案=>右鍵=>Team=>share project=> use or create repository in parent folder of project(打勾)=>Create Repository ## 第二步:commit之後再push change username and user email 找到專案位置後,去更改專案位置的username and user email 先找到專案在哪邊 專案=>右鍵=>properties ![](https://i.imgur.com/lJS9deo.png) 然後下 cmd指令 ``` git config --list ``` ``` git config user.name "Mike" git config user.email "mike@tradeserv.com" ``` ```shell= C:\ProgramData\Documents>cd C:\Users\TDG_USER\workspaceforv8\google-account-budget-contract-annual-consumption-statistics C:\Users\TDG_USER\workspaceforv8\google-account-budget-contract-annual-consumption-statistics>git config --list diff.astextplain.textconv=astextplain filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true http.sslbackend=openssl http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt core.autocrlf=true core.fscache=true core.symlinks=false pull.rebase=false credential.helper=manager-core credential.https://dev.azure.com.usehttppath=true init.defaultbranch=master core.symlinks=false core.repositoryformatversion=0 core.filemode=false core.logallrefupdates=true remote.origin.url=http://192.168.0.212:8080/google_fb_annual_spend.git remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/testing branch.master.rebase=false branch.testing.remote=origin branch.testing.merge=refs/heads/helloworld branch.testing.rebase=false branch.helloworld.remote=origin branch.helloworld.merge=refs/heads/helloworld branch.helloworld.rebase=false user.name=Mike user.email=mike@tradeserv.com ``` push ![](https://i.imgur.com/tW54FaY.png) URI填上gitlab上面的 Git儲存庫位置 ## 第三步:使用check out 來切換branch 遠端的分枝,必須要使用check out 到 local 才能切換各種branch 原本在 i am happy ![](https://i.imgur.com/KGNItVh.png) 後來在 add hello world ![](https://i.imgur.com/LbcV6qJ.png)