Git checkout when running build plan fails even though "test connection" succeeds
Asked by Priidu Kull:

When I run the build plan, doing git checkout fails with:

```
com.atlassian.bamboo.repository.RepositoryException: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException: Cannot read keypair, it doesn't contain any line with '-----BEGIN'
```

However, when I set up the repo and do "Test connection", the connection is good.

The id_rsa file which I provided begins with:

-----BEGIN RSA PRIVATE KEY-----  
Proc-Type: 4,ENCRYPTED  
DEK-Info:

I'm lost, please help me.

![repo config.png](/t5/image/serverpage/image-id/7327i633B09A0D8E24DDE/image-size/large?v=v2&px=999 "repo config.png")


Answers:
author: Gonchik Tsymzhitov
body: Hi!

If I understand correct, you have tried to configure plan.

But this way by default will work

if you follow this links

<https://confluence.atlassian.com/bamboo/checking-out-code-289277060.html>

<https://confluence.atlassian.com/bamboo/git-289277007.html>

BTW, you check your linked repositories here

{{BAMBOO_BASEURL}}/admin/configureLinkedRepositories!doDefault.action

I hope this is help for you.

Cheers,

Gonchik Tsymzhitov

comments: author: Priidu Kull
body: Hi, thanks for the links. I checked those and it seems to me that I have done everything by the book. More screenshots below.

![checked repo.png](https://community.atlassian.com/t5/image/serverpage/image-id/7334i2E0DFA64BD5833D8/image-size/large?v=v2&px=999 "checked repo.png")![task.png](https://community.atlassian.com/t5/image/serverpage/image-id/7333iE27E239C405297B1/image-size/large?v=v2&px=999 "task.png")


author: Gonchik Tsymzhitov
body: And your problem again reproduced?

What about key on git side? Is it accepted?


author: Priidu Kull
body: > And your problem again reproduced?

That was my original configuration and it again reproduced.
> What about key on git side? Is it accepted?

I'm not sure that I understand the question.

What seems to be happening is that my id_rsa is rejected. For example, the atlassian-bamboo.log reads:
> 2017-10-06 10:35:31,590 INFO \[17-BAM::Default Agent::Agent:pool-32-thread-1\] \[BuildAgentControllerImpl\] Agent 196609 checking build queue for executables...
>
> 2017-10-06 10:37:38,462 INFO \[10-BAM::PlanExec:pool-17-thread-2\] \[DefaultErrorHandler\] Recording an error: Unable to detect changes : VSR-E2E0 : com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException: Cannot read keypair, it doesn't contain any line with '-----BEGIN'
>
> 2017-10-06 10:37:51,526 INFO \[10-BAM::PlanExec:pool-17-thread-4\] \[DefaultErrorHandler\] Recording an error: Unable to detect changes : VSR-E2E : java.lang.IllegalArgumentException: Cannot read keypair, it doesn't contain any line with '-----BEGIN'

The custom SSH key is a proper private key and its respective public key is listed under /home/ubuntu/.ssh/authorized_keys


author: Gonchik Tsymzhitov
body: Well,

1. What is your version Bamboo?

2. Do any other plans work under this instance? What about agents?

3.
> The custom SSH key is a proper private key and its respective public key is listed under /home/ubuntu/.ssh/authorized_keys

It is good, but your agents knows about that?

Could you check it from agent directly?

Thanks

Best regards,

Gonchik Tsymzhitov


author: Priidu Kull
body: > 1. What is your version Bamboo?
>
> 2. Do any other plans work under this instance? What about agents?

Version 6.2.1, a new instance of Bamboo, trying to get the first plan off the ground.
> 3.
> > The custom SSH key is a proper private key and its respective public key is listed under /home/ubuntu/.ssh/authorized_keys
>
> It is good, but your agents knows about that?
>
> Could you check it from agent directly?

I am using the default agent, haven't applied any specific configurations for it.


author: Gonchik Tsymzhitov
body: Could you restart Bamboo?

In fact, it should work.

As I understand, you are already check this steps

<https://confluence.atlassian.com/bamkb/how-to-perform-a-git-ssh-checkout-from-a-script-task-741999875.html>


Tags: git