1、創建服務器和倉庫
#pkg install git //安裝git #adduser git //創建用戶git #git init --bare sample.git //初始化sample.git倉庫 #chown -R git:git sample.git //修改sample.git目錄的owner
2、客戶端機器創建SSH KEY,生成id_rsa
和id_rsa.pub
兩個文件
#ssh-keygen -t rsa -C "[email protected]"
3、將id_rsa.pub文件的內容拷貝到git服務器/home/git/.ssh/authorized_keys
文件裏,一行一個。
4、客戶端測試連接:
#git clone git@server:/srv/sample.git Cloning into 'sample'... warning: You appear to have cloned an empty repository.