1

I use GitLab repositories with two users (myself and a test user). For my test repository I have this in .git/config:

[core]
    sshCommand = ssh -i /test-project/test_id_rsa
[remote "origin"]
    url = [email protected]:test.tester/test-repo.git

And I don't use a passphrase at all with test_id_rsa.

'git pull', etc. works fine, but only when keychain is not running. When keychain is running, it seems my usual SSH key gets used, and Git commands will not work, as I come across as wrong key pair is used.

Without keychain:

lynoure@laptop:~/repo$ ssh -i ~/.ssh/a_test.tester_key [email protected]
Welcome to GitLab, test tester!
Connection to gitlab.example.com closed.

I start keychain with the shell, by:

eval `keychain --eval --agents ssh id_rsa

When I have started keychain:

lynoure@laptop:~/repo$ ssh -i ~/.ssh/a_test.tester_key [email protected]
Welcome to GitLab, Lynoure!
Connection to gitlab.example.com closed.

Is there some way I can avoid needing to disable keychain every time I use my test-repo in the tests?

0

1 Answer 1

1

If this is a key that one reasonably often, the trick is to add that key to keychain:

eval `keychain --eval --agents ssh id_rsa a_test.tester_key

After that, the right key will get used.

If one uses a key less often, or uses a lot of different keys, best just to stop keychain for that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .