zoukankan      html  css  js  c++  java
  • 利用Gogs自建私人git服务器以及两个关于ssh的坑

    Gogs的官网地址:https://gogs.io/docs/installation/install_from_binary

    安装教程,分为裸机docker两种方式,建议裸机方式使用linux的git用户进行安装【docker安装的忽略】

    安装完毕之后如果想要重新初始化设置,只需要删除/home/git/gogs/custom/conf/app.ini 这个文件,重新启动./gogs web即可,仓库以及用户信息等保留。

    剩下就是裸机安装过程中,为了使用ssh方式进行git clone所做的踩坑,

    第一个配置完ssh免密登录之后还需要进行密码验证,建议检查一下git用户家目录.ssh目录,以及authorized_keys文件的权限设置是否合理,具体参阅这篇博文解决SSH免密登录配置成功后不生效问题

    然后设置完之后可能会发现ssh –T user@host能够校验正确了,但是还是Git clone不下来,且git报错

    $ git clone xxxxxxxxxxxxxxxxxxxx
    Cloning into 'xxxxx'
    Gogs: Internal error
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.

    可能以为是ssh和权限相关设置不对导致,建议看下/home/git/gogs/log/hooks/serv.log 这个文件,如果里面出现类似报错

    2021/09/08 18:50:01 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH
    2021/09/08 19:03:46 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH
    2021/09/08 19:03:50 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH
    2021/09/08 19:08:50 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH
    2021/09/08 19:18:10 [ERROR] [...ogs.io/gogs/internal/cmd/serv.go:47 fail()] Failed to execute git command: exec: "git-upload-pack": executable file not found in $PATH

    可以参考这篇文章

    gogs仓库管理软件 exec: "git-upload-pack": executable file not found in $PATH

    这两个坑处理完毕之后基本就能正常使用了,剩下可能就是想要设置开机自启动,可以参考这几篇文章

    https://www.jianshu.com/p/c9ca7c16bd1fhttps://www.codenong.com/cs109129829/

    后者还提供了app.ini各种配置参数的详解,有兴趣可以了解一下.

    一般复制过去就行了,如果启动发现日志里面还是有类似 not found in $PATH 这种问题,可以把git相关的命令做软连接到/sbin目录下试试。

  • 相关阅读:
    重定向请求
    json处理
    post请求
    get请求
    提交cookie登录
    进击的Python【第三章】:Python基础(三)
    进击的Python【第二章】:Python基础(二)
    进击的Python【第一章】:Python背景初探与Python基础(一)
    java 内存分析
    java--循环练习
  • 原文地址:https://www.cnblogs.com/marshwinter/p/15244713.html
Copyright © 2011-2022 走看看