V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
SimleCp
V2EX  ›  Linux

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

  •  
  •   SimleCp · 2017-10-08 17:19:39 +08:00 · 3043 次点击
    这是一个创建于 2384 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在 Ubuntu 上搭建了 git 服务器, git clone 的时候一直说没有权限或者文件夹不存在, 后来我尝试用 root 登录, ls -a, 显示的文件夹都是对的. 然后我用 git 登录, ls -a, 没有找到我自己创建的文件夹, 导致 git clone 一直找不到目标文件夹. 我换成 root 用户去 git clone, 没问题. 现在我该怎么办?
    6 条回复    2017-10-15 09:50:27 +08:00
    noe132
        1
    noe132  
       2017-10-08 18:27:21 +08:00 via Android
    chown git:git /path/to/repo
    NetCobra
        2
    NetCobra  
       2017-10-08 18:44:03 +08:00
    权限问题,git 用户没有权限访问你创建的文件夹。
    解决方案如 @noe132 的回复,不过最好加上-R 参数。
    hawkflying
        3
    hawkflying  
       2017-10-08 20:55:50 +08:00
    SimleCp
        4
    SimleCp  
    OP
       2017-10-09 09:27:34 +08:00
    @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/
    SimleCp
        5
    SimleCp  
    OP
       2017-10-09 09:28:22 +08:00
    @NetCobra 麻烦看下 4 楼. T - T
    NetCobra
        6
    NetCobra  
       2017-10-15 09:50:27 +08:00
    @SimleCp 怀疑你的 srv 文件夹是建立在别的用户的 home 目录里了。
    在能显示 srv 目录的时候,用 pwd 看看你当前是在哪个目录里。
    我猜按照你的配置应该是在 /home/git 目录里面才对。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3265 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 12:42 · PVG 20:42 · LAX 05:42 · JFK 08:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.