Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
PinkStarrySky
V2EX  ›  Linux

在 Ubuntu 上搭建 git 服务器, git clone 有问题.

  •  
  •   PinkStarrySky · Oct 8, 2017 · 3938 views
    This topic created in 3164 days ago, the information mentioned may be changed or developed.
    我在 Ubuntu 上搭建了 git 服务器, git clone 的时候一直说没有权限或者文件夹不存在, 后来我尝试用 root 登录, ls -a, 显示的文件夹都是对的. 然后我用 git 登录, ls -a, 没有找到我自己创建的文件夹, 导致 git clone 一直找不到目标文件夹. 我换成 root 用户去 git clone, 没问题. 现在我该怎么办?
    6 replies    2017-10-15 09:50:27 +08:00
    noe132
        1
    noe132  
       Oct 8, 2017 via Android
    chown git:git /path/to/repo
    NetCobra
        2
    NetCobra  
       Oct 8, 2017
    权限问题,git 用户没有权限访问你创建的文件夹。
    解决方案如 @noe132 的回复,不过最好加上-R 参数。
    PinkStarrySky
        4
    PinkStarrySky  
    OP
       Oct 9, 2017
    @noe132 我查看了权限, 如下, srv 显示 git, 但是用 ssh 登录 git 账户, ls -a 里面还是没有 srv 这个文件夹.
    total 68
    drwx------ 8 root root 4096 Oct 8 08:57 ./
    drwxr-xr-x 23 root root 4096 Jul 26 00:47 ../
    -rw------- 1 root root 2441 Oct 9 01:15 .bash_history
    -rw-r--r-- 1 root root 3106 Oct 7 02:08 .bashrc
    drwx------ 2 root root 4096 Jul 26 00:49 .cache/
    drwx------ 2 root root 4096 Oct 7 01:53 .gnupg/
    -rw------- 1 root root 244 Oct 7 03:00 .mysql_history
    -rw-r--r-- 1 root root 221 Oct 7 02:10 .profile
    drwxr-xr-x 3 git git 4096 Oct 8 08:39 srv/
    PinkStarrySky
        5
    PinkStarrySky  
    OP
       Oct 9, 2017
    @NetCobra 麻烦看下 4 楼. T - T
    NetCobra
        6
    NetCobra  
       Oct 15, 2017
    @SimleCp 怀疑你的 srv 文件夹是建立在别的用户的 home 目录里了。
    在能显示 srv 目录的时候,用 pwd 看看你当前是在哪个目录里。
    我猜按照你的配置应该是在 /home/git 目录里面才对。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   855 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 20:39 · PVG 04:39 · LAX 13:39 · JFK 16:39
    ♥ Do have faith in what you're doing.