New access key is required but could not be added to Bitbucket Server.

Hi everyone, 

I'm trying to create a new linked repository in Bamboo. And when i'm doing this, i have the following error : 

New access key is required but could not be added to Bitbucket Server.

After some search i have found this response:

https://confluence.atlassian.com/bamkb/new-access-key-is-required-but-could-not-be-added-to-bitbucket-server-808616180.html 

I did everything in this solution: 

  • the redirection from port 22 to the port 7999 configured as SSH port, by making a virtualhost in apache. Here it is : 

    Listen 22
    <VirtualHost *:22>
    	ProxyPreserveHost On
    	ProxyRequests Off
    	ProxyPass / http://localhost:7999/
    	ProxyPassReverse / http://localhost:7999/
    	ServerName localhost
    	<Proxy *>
    		Order deny,allow
    		Allow from all
    	</Proxy>
    </VirtualHost>
  • Verify the git executable in my bamboo server capabilities. 

And i still have the same issue. I to replace the Bitbucket server by an old Stash and it makes me the same error. Displaying the log "<bamboo-install>/logs/catalina.out" it says that :

Public keu was added to Bitbucket Server .... Can't authenticate with Bitbucket Server despite successful public key storage

I need help, 

thanks.

2 answers

1 accepted

This widget could not be displayed.

I resolved this issue by replacing the Bitbucket SSH Base URL to the machine's ip address with the port:

X.X.X.253:7999

I think it's because of the reverse proxy.

This widget could not be displayed.

Hello Teddy,

Could you replicate the issue and search for something similar to the following entries in:

2017-11-17 10:39:41,081 INFO [http-nio-8085-exec-35] [BitbucketServerServerConfigurator] Public key was added to Bitbucket Server (Bamboo user: USERNAME, application: Bitbucket [http://localhost:7990], location: repository proj/repo): ssh-rsa AAAAB3NzaC...5yTu1j6C5Xrxd4YLTLtYUio7nJTkKRSZB http://localhost:8085
2017-11-17 10:39:41,089 INFO [http-nio-8085-exec-35] [GitCommandProcessor] Command was canceled: command /opt/git/bin/git version failed with code -1. Working directory was [/].
2017-11-17 10:39:41,094 INFO [http-nio-8085-exec-35] [BitbucketServerServerConfigurator] Can't authenticate with Bitbucket Server despite successful public key storage: ssh-rsa AAAAB3NzaC...5yTu1j6C5Xrxd4YLTLtYUio7nJTkKRSZB http://localhost:8085

In the log above, you can notice there is an issue with Git capability in Bamboo due to:

Command was canceled: command /opt/git/bin/git version failed with code -1.

In this case, it was required to correct Git location in Bamboo administration >> Server capabilities or Bamboo administration >> Agents >> <Your Agent> >> Capabilities

Are you able to telnet on port 22, 7999

telnet localhost 22
telnet localhost 7999

Is Bamboo and Bitbucket server running on the same box?

...
ServerName localhost
...


Kind regards,
Rafael 

Hello Rafael,

Thank you for the answer.

Here are the logs for my catalina.out file when replicating the issue:

2017-01-18 12:13:51,019 INFO [http-nio-8085-exec-6] [BitbucketServerServerConfigurator] Public key was added to Bitbucket Server (Bamboo user: USERNAME, application: Bitbucket [http://bitbucket.MY_URL], location: repository REP/repository): ssh-rsa AAAAB3NzaC1yc2...EMjJNIx http://bitbucket.MY_URL
2017-01-18 12:13:51,028 WARN [http-nio-8085-exec-6] [CacheAwareness] Inheriting disabledCaches:[com.atlassian.bamboo.ANY]
2017-01-18 12:13:53,827 INFO [http-nio-8085-exec-6] [BitbucketServerServerConfigurator] Can't authenticate with Bitbucket Server despite successful public key storage: ssh-rsa ssh-rsa AAAAB3NzaC1yc2...EMjJNIx http://bitbucket.MY_URL
2017-01-18 12:13:54,454 INFO [http-nio-8085-exec-20] [AccessLogFilter] USERNAME GET http://bitbucket.MY_URL/rest/stash/latest/servers/?_=1484736305320 433397kb

 

Bamboo and Bitbucket are in different boxes. Each one is working in Debian machines with a reverse proxy.

The VirtualHost is configured in the Bitbucket server. 

I tried the telnet command in my machine here what is displayed: 

# telnet localhost 7999
Trying ::1...
Connected to localhost.
Escape character is '^]'.

It does the same for port 22.

Thanks.

I am comming across this issue but see no solutions pertinent to my setup. I am running bamboo(5,12,4) and bitbucket(4.7.1) in docker (on the same machine). I had this all setup and working previously but somehow blew everything away updating licenses.  grrr. Reinstalling everything and setting up my repositories and application links, I get to creating a first project.

I give it al l the necessary settings and select a repository and branch. Bamboo can see the list of BitBucket repositories and list their branches for selection.

When I click "Configure plan", I get the red message box saying,
"New access key is required but could not be added to Bitbucket Server."

Looking at /bamboo/logs/atlassian-bamboo.log I see,
"New access key is required but could not be added to Bitbucket Server."

followed by, "Can't authenticate with Bitbucket Server despite successful public key storage: ssh-rsa AAA...."

I can see a key was added to the repository in bitbucket.

I have looked at all the usual suggestions but do not see anything left to try.

What is the cause of this? It is very frustrating.
FWIW, the log from the POST of the createPlan action is here:

2017-08-30 23:01:10,932 INFO [http-nio-8085-exec-16] [AccessLogFilter] root POST http://<myserver.com>:8085/build/admin/create/createPlan.action 568074kb                                                               
2017-08-30 23:01:11,834 INFO [http-nio-8085-exec-16] [StashRepository] Public key was added to Bitbucket Server (Bamboo user: root, application: Bitbucket [http://<myserver.com>:7990], location: repository ORD12/my-repository): ssh-rsa <key value> http://<myserver.com>:8085                
2017-08-30 23:01:11,846 WARN [http-nio-8085-exec-16] [CacheAwareness] Inheriting disabledCaches:[com.atlassian.bamboo.ANY]                                                                                                      
2017-08-30 23:01:11,957 INFO [http-nio-8085-exec-16] [StashRepository] Can't authenticate with Bitbucket Server despite successful public key storage: ssh-rsa <key value> http://<myserver.com>:8085                                                                                                          
2017-08-30 23:01:12,940 INFO [http-nio-8085-exec-14] [AccessLogFilter] root GET http://<myserver.com>:8085/rest/pref/latest/user/?expand=preferences.preference 462977kb                                                
2017-08-30 23:01:13,032 INFO [http-nio-8085-exec-17] [AccessLogFilter] root GET http://<myserver.com>:8085/rest/menu/latest/appswitcher?_=1504134072806 462722kb                                                        
2017-08-30 23:01:14,686 INFO [http-nio-8085-exec-23] [AccessLogFilter] root GET http://<myserver.com>:8085/rest/stash/latest/servers/ 460862kb                                                                          
2017-08-30 23:01:14,855 INFO [http-nio-8085-exec-15] [AccessLogFilter] root GET http://<myserver.com>:8085/rest/stash/latest/projects/repository?serverKey=4bd14a81-1533-3ae0-ba7e-960dcda18cb2&projectKey=ORD12&reposit
orySlug=my-repository&repositoryUrl=ssh%3A%2F%2Fgit%40bitbucket%3A7999%2Ford12%2Fmy-repository.git 460783kb                                                                                                           
2017-08-30 23:01:14,995 INFO [http-nio-8085-exec-4] [AccessLogFilter] root GET http://<myserver.com>:8085/rest/stash/latest/projects/repositories/permission?serverKey=4bd14a81-1533-3ae0-ba7e-960dcda18cb2&projectKey=O
RD12&repositorySlug=my-repository&_=1504134072808 458652kb                                                                                                                                                                 
2017-08-30 23:01:15,151 INFO [http-nio-8085-exec-20] [AccessLogFilter] root GET http://<myserver.com>:8085/rest/stash/latest/projects/repositories/branch?serverKey=4bd14a81-1533-3ae0-ba7e-960dcda18cb2&projectKey=ORD1
2&repositorySlug=my-repository&repositoryUrl=ssh%3A%2F%2Fgit%40bitbucket%3A7999%2Ford12%2Fmy-repository.git&branch=master 457111kb

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Friday in Bitbucket

What is your #1 piece of advice to new users getting started using Bitbucket?

Hello Community! My name is Claire Maynard, and I’m a Product Marketing Manager on the Bitbucket team. I’m interested in hearing what advice or tips you have for new users getting started on ...

187 views 12 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you