推荐一款开源的在Android平台上的git服务器app:gidder。它可以将手机作为可移动的git服务器。感谢Bob的推荐,在这里推荐给大家使用。
因为公司网络限制,evernote、为知笔记、有道笔记都上不了,github在国内网络状况不佳,所以找到这样一个工具,将自己的android手机变成一个移动的git服务器,每天下班前将公司记的笔记同步到自己的手机上,回家了再同步到私人电脑上,反之亦然。
这样我们就可以随身携带git服务器管理笔记或者文件。使用这种方式不仅可以不依赖互联网,而且还可以看到到自己笔记每一笔提交,随时回退修改,方便很多。只可惜现在只有Android平台上能勾使用。
下载该源码,编译生成apk,这样我们可以修改代码,加入或者修改我们想要的功能;
https://play.google.com/store/apps/details?id=net.antoniy.gidder.beta
国内的应用市场貌似没搜到;
https://pan.baidu.com/s/1eRWFxRk
请参考:http://devzc.com/archives/302/giddergit-server-on-android/
注意有的手机可能默认没有给该apk读写sdcard的权限,以致建不了仓,或有仓名却git clone找不到仓,需要手动给于apk sdcard读写权限,在settings里找设置的地方;
按照以上的操作基本上可以成功使用了。但可能会遇到些小事情。
出错log如下:
$ git push origin master
Unable to negotiate with 10.0.56.163 port 2222: no matching host key type found. Their offer: ssh-dss
fatal: Could not read from remote repository.
I have found the problem , The new OpenSSH versions disable the ssh-dss (DSA) public key algorithm.
DSA was deemed too weak and OpenSSH community recommends against its use.
If you see an error similar to this:
Unable to negotiate with 10.96.8.72: no matching host key type found. Their offer: ssh-dss
...then you must re-enable the DSA keys by editing your ~/.ssh/config file to add the following line:
HostkeyAlgorithms +ssh-dss
You may need to create the ~/.ssh/config file if it does not already exist.
After creating the file, you must restrict access permissions:
chmod 600 ~/.ssh/config
and then do the clone. That should work perfectly fine!
git remote set-url origin ssh://cdg@10.0.56.24:2222/mynotes.git
$ git push cdgnote master
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the DSA key sent by the remote host is
SHA256:MhOGEr5Oj3N9MoMM4DcHsNSfMKZk2bSEhGSsvFWUYco.
Please contact your system administrator.
Add correct host key in /c/Users/ni**.chen/.ssh/known_hosts to get rid of this message.
Offending DSA key in /c/Users/ni**.chen/.ssh/known_hosts:4
DSA host key for [10.0.56.201]:2222 has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
解决方法:删除known_host中对应url的条目,再push。
chengang@chengang-dev:~/local_notes/xmlocalnotes$ git pull
Password authentication
Password:
当前分支没有跟踪信息。
请指定您要合并哪一个分支。
详见 git-pull(1)。
git pull <remote> <branch>
如果您想要为此分支创建跟踪信息,您可以执行:
git branch --set-upstream-to=origin/<branch> master
solution:
chengang@chengang-dev:~/local_notes/xmlocalnotes$ git remote
origin
chengang@chengang-dev:~/local_notes/xmlocalnotes$ git branch -a
* master
remotes/origin/master
chengang@chengang-dev:~/local_notes/xmlocalnotes$ git branch --set-upstream-to=origin/master master
分支 master 设置为跟踪来自 origin 的远程分支 master。
chengang@chengang-dev:~/local_notes/xmlocalnotes$ git pull
#pull 成功
注意git branch –set-upstream-to=origin/master master set前面是两个横杠。
这样的使用方式很独立,不依赖互联网,随身携带,安全性高,再也不用担心公司网络限制了。
日后再有使用心得再续上。