1

I am trying to create a cloud config server using cloud foundry and below JSON :

{
    "count": 1,
    "git": {
        "privateKey": "****",
        "cloneOnStart": "false",
        "hostKey": "****",
        "label": "master",
        "hostKeyAlgorithm": "ssh-rsa",
        "uri": "ssh://git@bitbucketsc-ssh.emp.net:7999/proj/repo.git"
    }
}

I have generated a private ssh key and a public ssh key. My question is how do I tell my git to associate itself with these keys?

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
Tiya
  • 553
  • 8
  • 26

1 Answers1

0

Using "Specify an SSH key for git push for a given domain" and "GitLab (SSH) via public WIFI, port 22 blocked", the specifc content of a ~/.ssh/config file in your case would be:

Host cloud
  Hostname bitbucketsc-ssh.emp.net
  User git
  Port 7999
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/cloud

With ~/.ssh/cloud begin your private key, and ~/.ssh/cloud.pub your public key.

Check it works with ssh -T cloud
If it asks about the ECDSA key fingerprint, answer 'y' (yes)

Then, in your Git repo:

 git config set-url origin cloud:proj/repo.git

In that repo, any push will then use the url ssh://git@bitbucketsc-ssh.emp.net:7999/proj/repo.git.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • where is ~/.ssh/config file? I see 'ssh_config' and 'sshd_config' config files in C:/ProgramFilesGit/etc/ssh/ folder. But i doubt if these are the files. – Tiya May 05 '17 at 18:13
  • I see 1 empty .ssh folder without any files. I am working on a virtual machine. – Tiya May 05 '17 at 18:29
  • If your virtual machine is the one​from which you contact your remote machine e, then copy your public/private keys and write your config file in that .ssh folder. – VonC May 05 '17 at 18:40