【问题标题】:Permissions for git project when using on remote server在远程服务器上使用 git 项目的权限
【发布时间】:2016-04-21 19:39:02
【问题描述】:

这些是我在服务器上运行的命令:

$ whoami
git

$ ls -l
drwxr-xr-x 3 git  git  4096 Jan 16 05:48 git

$ ls -l git/
total 4
drwxrwxr-x 7 git git 4096 Jan 16 05:55 tpro.git

然后在我的本地机器上:

$ git remote add origin git@gitserver:/opt/git/t.git

然后 但是当我想从本地机器推送到服务器时,出现以下错误:

$ git push -u origin master 
fatal: '/opt/git/t.git' does not appear to be a git repository
fatal: Could not read from remote repository.

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

【问题讨论】:

    标签: git permissions file-permissions user-permissions


    【解决方案1】:

    您提到了tpro.git,但正在尝试访问t.git。

    确保路径存在。
    并确保tpro.git 确实在/opt/git 中(不是/home/git)

    那就试试吧:

    git remote set-url origin git@gitserver:/opt/git/tpro.git, 
    git push -u origin master
    

    这将确保master 每次都会推送到origin/master,只需一个简单的git push。

    【讨论】:

    • 即使我使用 tpro.git,它也会向我推荐 fatal: '/opt/git/t.git' does not appear to be a git repository
    • @MLSC 首先,/opt/git/tpro.git 在您的服务器上吗?
    • 是的,当然...命令 `ls -l git/` 在 /opt 目录中运行
    • @MLSC 好的(你的问题中没有包含pwd,所以我不得不问;))。二、可以ssh git@gitserver ls /opt/git/tpro.git吗?
    • 是的,我有:branches config description HEAD hooks info objects refs
    猜你喜欢
    • 2020-04-15
    • 2015-12-01
    • 1970-01-01
    • 2015-02-27
    • 2020-01-29
    • 1970-01-01
    • 1970-01-01
    • 2013-12-06
    • 2017-06-16
    相关资源
    最近更新 更多