Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

btibdev2 January 16, 2017

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

0 votes
Answer accepted
btibdev2 January 19, 2017

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.

0 votes
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 17, 2017

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 

btibdev2 January 18, 2017

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.

ssides August 30, 2017

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
Jurgen Schober January 25, 2019

I still have this issue after installing Kantenga Single Sign-on. Could be unrelated but after I installed this, I suddenly can't connect to Bitbucket (server) any more. Both on the same host. Ports are open in the firewall. At the first installation I think to remember Bamboo asked me to authorize Bitbucket access. How can I revoke that ? (and redo it?)

 

2019-01-25 12:50:28,804 INFO [http-nio-8085-exec-18] [AccessLogFilter] jschober POST http://bb-file01:8085/chain/admin/config/updateRepository.action 439701kb
2019-01-25 12:50:31,461 INFO [http-nio-8085-exec-18] [BitbucketServerServerConfigurator] Public key was added to Bitbucket Server (Bamboo user: jschober, application: Bitbucket [http://bb-file01:7990], location: repository CASUK/html5): ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmn0UPwTc/PhAAaaf08rItrmNpH3fuRSemaJKUqJpdAQOgintrftYI12Qbp2sWuZMOTkVG3a74LfstbOOcVaYQfTUsBiOEHtATu3QuePB1/sAfLqyZ5XN8DM+y/TTNRRA2aYHJS4zBaKe86zABVZafnLki48vdKPNysGhh4Ubg1aA69Z1Bwf4+R4q/O24DYDCBmO9Iw/mVtwlBPrgVztLW/9TF8cCRd3T7TfNi862oSBfv/+pRGgeEfIUMOXEPoIW4REJWitNHftdOoGIATZ9KPxiBTyoSq5zptz/voEVVskDqp6JPAmELsYguG/gH5psxlfZxeBoyOak/rNY30Wel http://bb-file01:8085
2019-01-25 12:50:31,476 INFO [http-nio-8085-exec-18] [BitbucketServerServerConfigurator] Can't authenticate with Bitbucket Server despite successful public key storage: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmn0UPwTc/PhAAaaf08rItrmNpH3fuRSemaJKUqJpdAQOgintrftYI12Qbp2sWuZMOTkVG3a74LfstbOOcVaYQfTUsBiOEHtATu3QuePB1/sAfLqyZ5XN8DM+y/TTNRRA2aYHJS4zBaKe86zABVZafnLki48vdKPNysGhh4Ubg1aA69Z1Bwf4+R4q/O24DYDCBmO9Iw/mVtwlBPrgVztLW/9TF8cCRd3T7TfNi862oSBfv/+pRGgeEfIUMOXEPoIW4REJWitNHftdOoGIATZ9KPxiBTyoSq5zptz/voEVVskDqp6JPAmELsYguG/gH5psxlfZxeBoyOak/rNY30Wel http://bb-file01:8085
2
Jurgen Schober January 25, 2019

Actually, this seems to have worked:

 

https://community.atlassian.com/t5/Sourcetree-questions/Authentication-with-bitbucket-server-problem/qaq-p/773253

 

ssh-add [private-key]

make sure the ssh-agent runs before you do so. 

And restarted the server. All good.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events