手机使用Gidder搭建git服务器

参考及下载Gidder:
https://blog.csdn.net/TaylorPotter/article/details/69808733

手机安装apk、启动及相关设置

在这里插入图片描述
Gidder默认设置
在这里插入图片描述
添加用户aaa
在这里插入图片描述
添加版本库New Project
在这里插入图片描述
为版本库New Project,指定用户aaa:pull、push权限
在这里插入图片描述
全部设置完成后,启动git服务
在这里插入图片描述
这里要留意:

  • 新建的版本库路径为:/newProject.git
  • git服务器在局域网的IP地址:192.168.1.6:2222

本地git项目配置

配置本地TortoiseGit项目remote参数:ssh://用户名@IP地址:端口号/版本库.git
在这里插入图片描述
这里的aaa是一个remote别名,这样做为了保留origin,通过别名来提交、拉取相关命令

# 提交
git push aaa master

# 拉取
git pull aaa master

可能发生的报错及相关处理

Unable to negotiate with 192.168.1.6 port 2222: no matching host key type found. Their offer: ssh-dss

解决方案是添加一个文件:%USERPROFILE%.ssh\config
如果.ssh目录不存在,则可以通过Git Bash(安装Git for windows时自带的MSysGit软件包),运行

ssh-keygen -o

然后全部回车使用默认参数即可,这里只是为了生成.ssh目录,不一定需要里边的id_rsa、pub等文件,详情可参考:https://git-scm.com/book/zh/v2/服务器上的-Git-生成-SSH-公钥
创建的.ssh\config,其内容为

HostkeyAlgorithms +ssh-dss

The authenticity of host xxx can’t be established.

直接输入yes继续即可
详情参考:https://blog.csdn.net/qq_21480607/article/details/91845794

fatal: Could not read from remote repository.

当连接,密码都OK之后依然发生报错

>git push aaa master
Password authentication
([email protected]) Password:
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

可能是手机端app需要读写存储卡权限
在这里插入图片描述
我这边完成以上全部设置,再重新创建一次/newProject.git,就可顺利提交了
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/tangyin025/article/details/123561113