Try   HackMD

GIT ft.windows伺服機版本庫

tags: GIT 版本控管 Work windows伺服機版本庫

對企業用戶而言,受限網路存取政策或禁止內部資料上傳外網,Github 等雲端服務可能不是選項,此時就得考量架設內部 Git 版控伺服器。對 Visual Studio 開發來說,TFS (Team Foundation Server) 除了版控外還提供專案管理、報表、自動建置/測試/部署等功能,絕對是 Git 私服首選。

這邊「Git 私服」方法,先介紹最簡單的玩法:完全不用裝軟體,直接用 Windows 的共享資料夾功能就行。
介面化工具使用 TortoiseGit

第一步

先找一台共用電腦或是沒再用的(隨便一台)
在上面開一個新資料夾 例:d:\git_server
Git在此建立版本庫,選擇設為純版本庫 git指令為:git init --bare

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

第二步

要使用的所有人的機器都設定好共用選項
d:\git_server文件設定共用

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

第三步

本地版本庫設定私人遠端url
git指令:git remote add origin(遠端url名稱) https://github.com/dexxxxx8/gxxxxt.git

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

設定完成後就能推送到私人遠端版本庫
git指令:git push

同事電腦下載 有兩種

有資料夾

直接設定遠端url
拉取 選擇剛設定的遠端名稱
git指令:git pull origin(遠端url名稱) master(分支名稱)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

無資料夾

直接開cmd或是其他終端
輸入指令 git clone \\192.xxx.xx.xx\xxx(名稱)
最後再設定第三步

上一篇-雲端儲存庫