I have a server that needs to run the command "git ls-remote" against one of my bitbucket Git repositories to locate a branch's commit hash. I think I need to add bitbucket's public key to my .ssh/known_hosts file on my server in order to avoid the dreaded prompt, "The authenticity of 'bitbucket.org (ip6) can't be established." However, I need to run this command inside a script. How can I fetch that key inside my script and then write it to the known_hosts file? I think I'm supposed to use the command "ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts" but when I run that command I get some extra lines that don't look like they belong in my known_hosts file:
# bitbucket.org:22 SSH-2.0-conker... app-133 <- Don't want this line
# bitbucket.org:22 SSH-2.0-conker... app-126 <- Don't want this line
bitbucket.org ssh-rsa AAAAB3N... <- Just need this line?
# bitbucket.org:22 SSH-2.0-conker... app-132 <- Don't want this line
I think all I want is the third line above. Is there a command to just pull that piece of data out so I can append it to my known_hosts file? Thanks.
As I understand your problem mostly related IPv6,
Please, have a look that answer
Host bitbucket HostName bitbucket.org User git IdentityFile ~/.ssh/id_rsa_bitbucket AddressFamily inet
I hope that info will help for you.
Thanks Gonchik. But I don't see how this is related to ipv6. I'm just trying to figure out how to discover a bitbucket public RSA key programmatically so that I can insert it in my known_hosts file. Perhaps bb posts it somewhere and I can just copy it into the file and push the file to my server.
Hello Community, I’m Anton Genkin, a product manager on the Bitbucket Server and Data Center team and am excited to share that Bitbucket Server 7.0 is now available! It's a platform release, one th...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events