>本文解釋瞭如何將Raspberry Pi設置為私人Git服務器,並提供了用於管理和共享代碼的公共服務的經濟高效替代方案。
鍵優點:
設置過程:
sudo apt-get install git
。
sudo adduser git
> 在Raspberry pi上創建一個存儲庫:
創建一個目錄:(用您的存儲庫名稱替換)。
mkdir /home/git/MyRepo.git
>
MyRepo
cd /home/git/MyRepo.git && git init --bare
>
鏈接本地和遠程存儲庫:git init
使用:
與存儲庫一起工作: 在本地(git remote add pi git@<your_pi_ip_address>:/home/git/MyRepo.git</your_pi_ip_address>
)進行提交,然後將更改推向服務器(<your_pi_ip_address></your_pi_ip_address>
)。使用
克隆一個存儲庫:在另一台計算機上訪問存儲庫,請使用:git commit -m "Your message"
git push pi master
克隆它
git pull pi master
此設置是基本的,並且缺少諸如GitHub等服務中的拉請求之類的功能。 git clone git@<your_pi_ip_address>:/home/git/MyRepo.git</your_pi_ip_address>
。
以上是將Raspberry Pi設置為GIT服務器的詳細內容。更多資訊請關注PHP中文網其他相關文章!