·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> app软件开发 >> IOS开发 >> 使用百度网盘配置私有Git服务

使用百度网盘配置私有Git服务

作者:佚名      IOS开发编辑:admin      更新时间:2022-07-23

GitHub上免费的版本只能开源代码库,有时候需要配置些私有的服务,不方便公开。现在免费的网盘的容量越来越大,可以用来做存储的服务,如果只使用网盘存储合并代码很不方便,所以使用网盘+git 配置私有仓库。

1.首先当然是注册网盘,然后在PC上建立共享文件夹,用于网盘的自动同步。

2.在共享文件中初始化Git服务做远程仓库

cd /Users/apple/百度云同步网盘/BaiduRepo //创建服务目录
git --bare init //初始化仓库

3.工程中添加git

git init            //在工程目录下初始化一个本地Git库
git add .           //将工程目录下所有文件添加到索引
git commit -m "first commit"     //提交 

4.提交本地工程到网盘

git remote add BaiduRepo /Users/apple/百度云同步网盘/BaiduRepo
//将本地仓库master分支push到远程仓库
git push BaiduRepo master 

 5.提交成功后,可以正常使用git操作

$ git clone /Users/apple/百度云同步盘/BaiduRepo  //clone到本地
$ git staus //查看所有文件状态
$ git add . //添加所有修改
$ git push //提交到远程服务
$ git pull //更新到本地

 

如果commit时出现如下提交错误

$ git commit -a
error: There was a PRoblem with the editor 'vi'.
Please supply the message using either -m or -F option.
promote:BaiduRepo apple$ git commit -a

 解决方法

$ git config --global core.editor vim

 

参考资料:

http://www.cnblogs.com/zdz8207/archive/2012/05/20/2509356.html