remote:Permission denied(publickey)hooks / post-receive

时间:2017-01-18 15:17:11

标签: git github gitlab

在我的服务器上,我使用此代码进行了post-receive挂钩

git push --mirror origin

(来源是:git remote add origin git@gitlab.com:myproject / myproject.git)

如果我在服务器上执行此文件,它可以工作,但如果我在本地计算机上执行

git push live

我收到此错误:

Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 286 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Votre branche est en avance sur 'origin/master' de 1 commit.
remote:   (utilisez "git push" pour publier vos commits locaux)
remote: Permission denied (publickey).
remote: fatal: Could not read from remote repository.
remote: 
remote: Please make sure you have the correct access rights
remote: and the repository exists.
To ssh://myserver/var/www/html/myproject/myproject.git

我知道这是一个权限问题,但我不明白应该更改哪些权限。

我的密钥似乎拥有正确的权限:

server$ chmod 700 ~/.ssh
server$ chmod 600 ~/.ssh/authorized_keys

这是我在服务器上执行post-receive时的输出:

./hooks/post-receive 
Votre branche est en avance sur 'origin/master' de 1 commit.
  (utilisez "git push" pour publier vos commits locaux)
Décompte des objets: 3, fait.
Delta compression using up to 2 threads.
Compression des objets: 100% (3/3), fait.
Écriture des objets: 100% (3/3), 286 bytes | 0 bytes/s, fait.
Total 3 (delta 2), reused 0 (delta 0)
To git@gitlab.com:myproject/myproject.git
   3ae70c6..6e7c1d8  master -> master)

0 个答案:

没有答案