简体   繁体   中英

GIT Pull from Remote Origin Ignoring SSH Keys - Asks For Password

The basic problem is that every time I execute a git pull, I am asked for a password.

Servers

I have a 2-server setup. Server1 hosts the git remote origin. Both server1 and server2 pull from that server1 origin into their web-accessible folders.

Users

The same 2 users are on both servers: an admin user and a file user. The admin user has the ability to behave as root, and the file user owns the files. Both users belong to the same group. The file user and the group own the web-accessible files, and, on server1, the remote origin files.

SSH

The server1admin, server2admin, and the server2file users have been set up to ssh using public keys as server1file user, and if I try to ssh directly from the command line, everything works as expected.

GIT

On server1, the git origin is /git_repos/repo.git

On server2, the git origin is ssh://server1file@server1/git_repos/repo.git

The Problem, Rephrased

When I am logged into server2 as server2admin and execute git pull, I'm asked for the server1file user's password, and I don't know why.

Curiously enough, if I change the origin on server2 to ssh://server1admin@server1/git_repos/repo.git, I am asked for the server1admin user's password.

Any ideas about what I should look at to figure out why a password is necessary?

尝试在服务器2上运行命令ssh-add

虽然我不确定为什么,但是将server1file和server1admin用户添加到server2file用户的authorized_keys文件中可以解决此问题。

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