Git post-receive hook:“remote:权限被拒绝,请再试一次。”

时间:2012-02-16 15:39:34

标签: git ssh githooks openssh

我在/home/dan/repo/有一个裸存储库,/home/dan/www/project/有一个工作副本 我希望工作副本在每次提交时自动将当前分支从repo拉到repo

我在/home/dan/repo/hooks/post-update创建了一个文件:

#!/bin/sh

cd /home/dan/www/project || exit
unset GIT_DIR
git pull

exec git-update-server-info

工作副本的origin设置为repo

[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = dan@server:/home/dan/repo/

然而,在每次提交时我都会收到错误:

remote: Permission denied, please try again.
remote: Permission denied, please try again.
remote: Permission denied (publickey,password).
remote: fatal: The remote end hung up unexpectedly

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

从工作副本origin中的url远程.git/config删除用户名解决了这个问题。

之前:

url = dan@server:/home/dan/repo/

后:

url = /home/dan/repo/