git 服务器搭建/迁移(保留commit记录)
服务器搭建
- 添加用户(见链接)
- 在服务器上创建仓库
# Git就会创建一个裸仓库,裸仓库没有工作区,因为服务器上的Git仓库纯粹是为了共享,
# 所以不让用户直接登录到服务器上去改工作区,并且服务器上的Git仓库通常都以.git结尾。
sudo git init --bare sample.git
# 然后,把owner改为git:
sudo chown -R git:git sample.git
使用
$ git clone git@server:/srv/sample.git
Cloning into 'sample'...
warning: You appear to have cloned an empty repository.