简体   繁体   中英

how can I set up ssh acces to remte bare repository for admin?

On a VPS I can login using

ssh admin@server.com

I have created a bare repository in:

/var/repo/site.git

which has:

drwxr-xr-x   7 root root  119 Jan 31 13:35 site.git

Locally I set up:

git remote add production ssh://admin@server.com/../../var/repo/site.git

But when I try tyo push I get this error:

PS D:\path\site-directory> git push production master
admin@server.com's password: 
Enumerating objects: 1152, done.
Counting objects: 100% (1152/1152), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1073/1073), done.
remote: fatal: Unable to create temporary file '/var/repo/site.git/./objects/pack/tmp_pack_XXXXXX': Permission denied
fatal: sha1 file '<stdout>' write error: Broken pipe
error: remote unpack failed: index-pack abnormal exit
To ssh://server.com/../../var/repo/site.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'ssh://server.com/../../var/repo/site.git'

I think that I have to adjust some permissions, or I may have set up the wrong path.

Can anyone help me figure out how to troubleshoot?

This directory:

drwxr-xr-x   7 root root  119 Jan 31 13:35 site.git

Has a user ownership set to root. Since admin is not the owner of the directory, Linux next checks if the directory is world-writable, which it is not, so it denies access.

The simplest way to solve this is to make admin the owner of this directory.

Run this command:

sudo chown -R admin:admin /var/repo/site.git

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM