I have configured my ssh keys in circle ci, and I m also adding it in my config.yml like this:
steps:
- add_ssh_keys:
fingerprints:
- "My fingerprint"
But during the cicd it throws this message: 'There are no configured ssh keys to install'
By The way, it was working fine the entire last month.
Any clue? Thanks anyway
Related
I have encountered a problem while attempting to deploy my code to a Droplet server (running Ubuntu) using BitBucket Pipeline.
I have set the necessary environment variables (SSH_PRIVATE_KEY, SSH_USER, SSH_HOST) and added the public key of the SSH_PRIVATE_KEY to the ~/.ssh/authorized_keys file on the server. When I manually deploy from the server, there are no issues with cloning or pulling. However, during the automatic CI deployment stage, I am encountering the error shown in the attached image.
This is my .yml configuration.
Thanks for helps in advance.
To refer to the values of the variables in defined in the configuration, you script should use $VARIABLE_NAME, not VARIABLE_NAME as that is literally that string.
- pipe: atlassian/ssh-run:latest
variables:
SSH_KEY: $SSH_KEY
SSH_USER: $SSH_USER
SERVER: $SSH_HOST
COMMAND: "/app/deploy_dev01.sh"
Also, note some pitfalls exists when using an explicit $SSH_KEY, it is generally easier and safer to use the default key provided by Bitbucket, see Load key "/root/.ssh/pipelines_id": invalid format
I am making ci/cd with bitbucket and droplet ubuntu.
this is my bitbucket-pipeline.yml:
image: atlassian/default-image:3
pipelines:
default:
- parallel:
- step:
name: 'Build and Test'
script:
- echo "Your build and test goes here..."
- step:
name: deploy
deployment: test
script:
- echo "Deploying master to live"
- pipe: atlassian/ssh-run:0.1.4
variables:
SSH_USER: 'root'
SERVER: '259.MY DROPLET PUBLIC IP.198'
PASSWORD: '4adsfdsh'
COMMAND: 'ci-scripts/pull-deploy-master.sh'
MODE: 'script'
I tried to login to my server and this command on the server: ci-scripts/pull-deploy-master.sh but it's ssh login fail with password
and I am getting this error: ✖ No default SSH key configured in Pipelines.
Can anyone please tell me how to fix this?
I don't see that PASSWORD variable being acknowledged anywhere in the atlassian/ssh-run pipe documentation.
I think it is being ignored and the pipe is trying to fallback to your repository default ssh key, which you didn't set up.
Even if the PASSWORD could be passed as a variable, and set up as a secret variable, which I fear you neither did, I would strongly encourage to use ssh-key authentication and NOT password authentication.
Please follow this guideline https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/#Steps-to-use-SSH-keys-in-Pipelines . This mainly involves:
creating a key pair from your repository settings
whitelisting your remote server fingerprint from your repository settings
authorizing the public key in your remote server
After Executing > rhc setup and then entering my hostname i always get this error message
Steps that i've done:
1- installed Ruby 1.9.3
2- installed rhc using gem gem install rhc
3- Executed > rhc setup
It seems that this is some kind of bug.
But, there is another way to manually generate SSH public-private key pairs and upload them to OpenShift
1- Generate new SSH keys
C:\> ssh-keygen
It will ask you where to save the key files just press "Enter" -> this will generate key-pairs with name "id_rsa" in "C:\Users\YOU\.ssh"
also Press Enter when asked for passphrase to keep it empty
2- Upload you Public Key to OpenShift
C:/>rhc sshkey add id_rsa C:\Users\YOU\.ssh\id_rsa.pub
It will then ask you for your credentials on OpenShift, once done your public key is now uploaded to OpenShift
3- Configuring SSH to use the Generated private key when connecting to your APP
a- Make sure you have an environment variable "HOME" pointing to "C:/Users/YOU/.ssh", if not create one
b- open "C:/Users/YOU/.ssh/" if you find config file open it , if not create one by running the following command:
touch config
Now add the following lines to config file:
Host ChooseAName
HostName APPName-NameSpace.rhcloud.com
IdentityFile ~\.ssh\id_rsa.pub
save and close
4- Now Connecting to your App:
First, Get the command that enables you to connect remotely to your app on rhcloud server , you can get it using the OpenShift web console
enter that to you command line and you will be connected trough a secure shell to you APP on rhcloud
In my case, it was because I was typing
rhc setup --server=my_app_domain
but in fact, the relevant server was the Openshift Enterprise server that was hosting my domain. When I used this server, it worked fine.
when I am trying to clone a rails app repo I have got permission to, I am getting this issue.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Even after adding public key by generating one, I am unable to solve this.
Although I am able to clone using he https method but after making changes, the same error comes while I try to push the code.
Please suggest an answer for this.
First, cd into your .ssh directory. Open up the terminal and run:
cd ~/.ssh && ssh-keygen
Second, you need to copy this to your clipboard:
cat id_rsa.pub | pbcopy # On OSX
cat id_rsa.pub | xclip # On Linux
Third, add your newly generated ssh key to your account via the github/bitbucket website (just paste there).
Next, setup your git config:
git config --global user.name 'your_user_name'
git config --global user.email 'your_email'
Finally, restart your command line to make sure the config is reloaded.
Now, you should be able to clone and push from/to your github repository.
For more information on this, see this github page or this bitbucket page.
When attempting to clone, push, or pull over SSH with Git, you may receive one of these messages if Bitbucket couldn't authenticate with the keys that your SSH agent offered.
Here are the most common reasons why you may see these messages:
You used sudo when attempting the connection
You shouldn't use sudo when cloning, pushing, or pulling because the ssh-agent runs on the user level, not the root level.
Your public key isn't loaded into Bitbucket
To check if your public key is loaded into Bitbucket, do the following:
From Bitbucket, choose Personal settings from your avatar in the lower left.
The Account settings page displays.
Click SSH keys.
The SSH keys page shows a list of any existing keys.
If you don't have any keys listed, you can follow our Set up an SSH key documentation to set one up.
Your key isn't loaded into your SSH agent
If your SSH agent doesn't know to offer Bitbucket a key, the connection fails. You may run into this issue if you've recently restarted your system.
You can refer to this Article for more informations:
https://support.atlassian.com/bitbucket-cloud/docs/troubleshoot-ssh-issues/
Check few things.
Is the generated new key is the one your ssh agent using when trying to ssh to server.
(Your ssh agent might be using a different key than the one you generated)
use this to list currently loaded keys by agent.
ssh-add -L
You properly added public key to your repository hosting location.
The keys corresponding to above 1 and 2 should match.
Please see this article: GitHub: Generating SSH Keys. What happens when you run:
ssh -T git#bitbucket.org
?
You may have added the wrong key to authenticate with.
I faced this error when I created another repository in my local. My ssh-keys were already set up and I was trying to push code through vs code.
The issue got resolved when I git push-ed through git bash like I was doing before.
For bit bucket I think I have tried everything with ssh. I have tried the answer from this stackoverflow question as well. But it doesn't work. So finally I just changed the clone command from SSH to HTTPS and it worked. Only then it asked for password for my account.
I am a newbie on OpenShift , I have a problem with it ,
When I do
rhc app git-clone mynewapp
Your public ssh key must be uploaded to the OpenShift server. Would you like us to upload it for you? (yes/no) yes
You can enter a name for your key, or leave it blank to use the default name. Using the same name as an existing key will overwrite
the old key.
Since you do not have any keys associated with your OpenShift account,
your new key will be uploaded as the 'default' key
type: ssh-rsa
content:
AAAAB3NzaC1yc2EAAAADAQABAAABAQCuA9kdmq5Pf5JLyHeMpWQ+XYaEzw8UWziUfXohMR8Dt9ZwkIb4WSHLzcGKKpclZvWOi2UZMQCOp8wCij5VS/ps8/3YPQVYyg+GHAAZIr
WsGDnJdpRF/shUnvoPx6XTzzLFHxBOS92LktjvX/T+xqftS6aVugD0cQ0vVkA6e5FwIjwo4JHoJGRFzgdaSbC5nDiHvDX7zhtnQXe1TeTK5nhjDj/uZPaj5h0hRv4Zx0EzfDYu
Uig0GCoFrWsJ9MTw5F7WEeOtPNtp2uFubuDCDpoBtBBDDmL642AY8r9IV4REGSfUDzV+M0Ab33ubRYKmp+ok6MtBrlTKg94PaVvuf2V5
fingerprint: eb:41:87:1b:e8:4e:ec:c0:8d:c8:c6:5e:a2:6a:ad:b4
Uploading key 'default' from /home/toriq/.ssh/id_rsa.pub
Cloning into 'myapp'...
done
Suddenly an error appear:
Error in git clone - Agent admitted failure to sign using the key.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: The remote end hung up unexpectedly
Any solution for this ?
It could be similar to this GitHub help page:
For most users, simply running ssh-add to load your keys into the SSH agent will fix this issue.
$ ssh-add
# Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap]
# Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)
If your key does not have the default filename, you'll have to pass the path to ssh-add:
$ ssh-add ~/.ssh/my_other_key
# Enter passphrase for /home/you/.ssh/my_other_key: [tappity tap tap]
# Identity added: /home/you/.ssh/my_other_key (/home/you/.ssh/my_other_key)
You can install rhc openshift client tools
Then run setup which will then upload your ssh keys.
rhc setup