在远程服务器上使用时 git 项目的权限

Permissions for git project when using on remote server

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

$ 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.

您提到 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