Clone with SSH Issues - ssh

I am trying to clone a repository on git.dscoe.org
This is the situation:
-Created key using keygen in terminal
-Added key to Gitlab
Getting this error:
git#git.dscoe.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I've tried changing the ownership of the .ssh file, and the result from ls -al is attached in the image.
This is how I have my config file
Debugging output
Any help would be so amazing! Thank you so much!!

Make sure you have added:
the public key content (as one line) the the GitLab hosted on git.dscoe.org (and not to your gitlab.com account)
set the right permissions to ~/.ssh, keys and config
add the key to ssh-agent if it is protected by a passphrase
or try and generate a new one with:
ssh-keygen -t rsa -m PEM -P ""

Related

Error "no such identity: ... /.ssh/ id_rsa_gitlab"

I accidentally deleted my id_rsa_gitlab file, and when I wanted to clone from GitLab, I received this error.
no such identity:/Users/directory/.ssh/id_rsa_gitlab: No such file or directory
I'm new to pipelines, and I tried to follow tutorials on how to configure .ssh, but it's just the id_rsa file that gets configured.
The command would be:
ssh-keygen -t rsa -P "" -f /Users/directory/.ssh/id_rsa_gitlab
That would restore a private/public key, and you need to register the public key to your account.
Check which Host entry references that private key in your /Users/directory/.ssh/config file.
Generate a new SSH key and add it to your GitLab repository.
See Adding your SSH key to GitLab.

Permission denied (publickey) trying to SSH into CircleCI job

I followed the steps of this doc: https://circleci.com/docs/add-ssh-key#circleci-cloud-or-server-3-x
I generated my key:
ssh-keygen -m PEM -t rsa -C "myname#myemail.com"
I copied the content of .ssh/id_ed25519, went to Project Settings > SSH Keys > Additional SHH Keys, and pasted the content of my Key.
However, when I try to ssh I receive the following error:
ssh -p 54782 x.x.x.130
The authenticity of host '[x.x.x.130]:54782 ([x.x.x.x]:54782)' can't be established.
ED25519 key fingerprint is SHA256:xxx
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[x.x.x.130]:54782' (ED25519) to the list of known hosts.
myname#x.x.x.130: Permission denied (publickey).
I will appreciate your help. Thanks
The instructions you followed are for something else; they are about adding an SSH key to the project in case you need to SSH into remote servers from within a job.
If you want to SSH into your job, you need to add the key you generated on your local machine to your VCS (GitHub or Bitbucket) account.

github deploy key not working for my cyberpanel user

I have a site on CyberPanel, user "thows3051" and want to use git to manage my site. But when I try ssh -T git#github.com I get git#github.com: Permission denied (publickey)..
If I ssh into the server on that user ssh thows3051#mysite.com, into the .ssh directory, there is a thows3051.pub file which I copied the contents into the repo on github under "deploy keys".
EDIT
Was able to explicitly use the correct key with ssh -i ~/.ssh/thows3051 -T git#github.com which shows You've successfully authenticated....
So my question is why isn't the user using the right ssh key?
Thanks in advance
Was able to fix it. I'm not sure what key was being used, if any?
But if you create a file in ~/.ssh/config, you can put the following inside:
IdentityFile ~/.ssh/thows3051
And it will use that key.
Note that you can set specific keys for certain hosts, for example:
Host github.com
IdentityFile ~/.ssh/github.key

Microsoft TFS ssh cloning fails

I am trying to clone a repo from a project on my Team Foundation Server domain. I have created an SSH key under my profile security. However after accepting the repo's key I am still requested to sign in with a password and the authentication fails:
git clone ssh://mydomain#mydomain.visualstudio.com:22/Project/_git/project-repo
Cloning into 'project-repo'...
mydomain#mydomain.visualstudio.com's password:
Permission denied, please try again.
mydomain#mydomain.visualstudio.com's password:
Permission denied, please try again.
mydomain#mydomain.visualstudio.com's password:
Permission denied (password,publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have tried both my visualstudio.com password and SHH key password none of which work.But Why is it asking me for a password?
The prerequisite to use ssh for VSTS as below:
Generate ssh key. In git bash, use ssh-kengen in git bash -> select path to save the key -> enter passphrase (if you don’t want passphrase, press enter direcly).
Add the content of .ssh/id_rsa.pub file in KeyData in VSTS SSH public keys (profile -> security).
For your situation, it seems the conent of .ssh/id_rsa.pub is not same with VSTS SSH public keys. So you'd better do step1 and setp2 above and ten clone again with ssh protocol.
The way I resolved this was by deleting and recreating my id_rsa.pub without a password.
The default authentication mode when using SSH is the private key. Whenever that fails for some reason, the ssh-agent falls back to username and password based authentication.
There are several reasons why the default key based authentication might have failed. Following are the most common cases :
a) The ssh-agent cannot find the default private key file which is id_rsa, and no other key path is specified explicitly.
b) The public key stored in the server is incorrect.
c) The path you're trying to clone is incorrect.
In any case, to troubleshoot the issue first of all execute the git clone command with verbose logging with the command :
GIT_TRACE=1 GIT_SSH_COMMAND="ssh -vvv" git clone ssh://pathToYourRepo
You can go through each step in the log to get an intuition of what the issue might be.
Troubleshooting in case of (a)
Make sure you have the default key name id_rsa in the .ssh directory. You might have specified some different keyname when generating the key with ssh-keygen command or maybe there isn't any key at all).
In case you want to specify a different key for authentication, use the following command :
ssh-agent bash -c 'ssh-add ~/.ssh/anotherKey; git clone ssh://pathToYourRepo'
Troubleshooting in case of (b)
Make sure there aren't extra white spaces when storing the public key in the server.
Troubleshooting in case of (c)
Make sure you aren't trying to clone with the https version of the repository path.

SSH 'command not found' when trying to connect to AWS

I'm new to Amazon web services and have managed to set up an instance.
I already have the ssh directory on my machine at: /usr/bin/ssh
I have also downloaded a Pem key file to my machine and have tried to copy my Pem key file into that directory but I cannot navigate to it. When I try:
cd /usr/bin/ssh
I get:
-bash: cd: /usr/bin/ssh: Not a directory
When I just try to type the command:
ssh
I get the following:
BEGIN: command not found
: command not found2: MIIEpAIBAAKCAQEAu6JORnapcVdvAwPm+6LVBA3n8chlGU4nE0g9nyD8zSDWlATJpf1Td35tPrxj
: No such file or directory
can anyone help with this?
I'm on OSX Lion 10.8.4 if that helps!
Your problem appears to be related to configuring the ssh keys. First, some clarifications:
/usr/bin/ssh is not a directory, it is the actual secure shell program. Do not modify it. (If you have already destroyed your ssh installation, you would need to restore the installation: http://support.apple.com/kb/PH10763).
ssh will use a public and a private key (keypair) to authenticate. The private key should be stored locally on your computer, generally in the .ssh folder inside your home directory (~/.ssh)
You may have generated the keypair yourself, or have gotten one generated by AWS.
I will assume your .pem file is the private key portion of the keypair, and that you have downloaded that from AWS after following a procedure along the lines of: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-to-have-aws-create-the-key-pair-for-you.html.
In that case, you need to simply:
copy the .pem file into your ~/.ssh directory.
rename it to id_rsa
ensure that you have correctly set permissions for the private key and .ssh directory (ssh is picky), typically 600 for the id_rsa file and 700 for the .ssh directory.
initiate the ssh connection via ssh username#host