首先要安装autofs,然后link网络盘到本地路径使用;
安装
sudo apt-get install autofs
配置autofs
sudo vi /etc/auto.master #在下图所示部分加入代码
/net /etc/auto.net --timeout=3600,rw,bg,hard,nointr,nolock,timeo=60,rsize=32768,wsize=32768,tcp,vers=3,noacl
重启autofs服务
sudo service autofs restart
验证使用
ls /net/szgit02/gerrit2 #如果显示有如下返回结果,表示连接成功
dr-xr-xr-x 3 root root 0 Oct 12 18:36 hcgit_site
dr-xr-xr-x 3 root root 0 Oct 12 18:36 marshmallow-master
dr-xr-xr-x 3 root root 0 Oct 12 18:36 review_site
drwxr-xr-x 2 root root 4096 Jul 5 12:56 test
配置reference
创建/tools 目录,并chmod 777的权限
cd /tools
ln -s /net/szgit02/gerrit2/hcgit_site/git ./hcgit
ln -s /net/szgit02/gerrit2/review_site/git ./hcgit03
ln -s /net/szgit01/gerrit2/review_site/git ./szgit01
完成如上配置之后,就可以在部门的编译服务器上加速下载hcgit/hcgit03/szgit01上的code了,示例如下(repo需要自行配置):
下载hcgit服务器上的code
repo init -u ssh://hcgit:29418/platform/manifest -b xxxx-xxx-xxx --reference=/tools/hcgit
下载hcgit03服务器上的code
repo init -u ssh://hcgit03:29418/supernova/manifest -b xxxx-xxxx-xxx --reference=/tools/hcgit03
下载szgit01服务器上的code
repo init -u ssh://szgit01:26918/platform/manifest -b xxxx-xxx-xxx --reference=/tools/szgit01