0

When attempting to git clone a forked repository I'm getting the following message

/Users/userName/.ssh/config: line 2: Bad configuration option: st
/Users/userName/.ssh/config: terminating, 1 bad configuration options
fatal: Could not read from remote repository.

I've had no issues using git until I ran this script earlier today from a post I found while trying to clone over public wifi -

https://stackoverflow.com/questions/7953806/github-ssh-via-public-wifi-
port-22-blocked

I'm pretty new to git so, I'm really at a lost of what's happening. I believe I'd must have modified my config file but I'm unsure how to correct it.

ayeteo
  • 244
  • 3
  • 5
  • 14
  • 1
    Does the forked repo also hosted in github? And did you add the SSH public key (in id_rsa.pub) in your github account? And what's your config for ssh now? – Marina Liu Dec 18 '17 at 06:24
  • @MarinaLiu-MSFT Yes, the repo is hosted in github. I didn't add the SSH key to my github and I'm not sure how to check my config now. Can you guide me on that or rather tell me how to undo the mods I made from the post ? – ayeteo Dec 18 '17 at 06:30
  • I added an answer for how to re-generate ssh key and add the key to github for authentication, and you can have a try. – Marina Liu Dec 18 '17 at 06:46

1 Answers1

1

It’s not necessary to make additional configuration for the SSH key.

If you have made modifications in your SSH key, you can generate a new one to replace the current one:

ssh-keygen

Then press enter to finish the ssh key generate.

Then add the new generated SSH key in github:

Github -> Settings (https://github.com/settings/keys) -> New SSH key -> name a title -> open the file id_rsa.pub and copy the contents of the file as the key in github (as below picture) -> Add SSH key.

enter image description here

Now clone again from github, it should clone successful (if there has config file under .ssh folder, the config file should be deleted).

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • I've done exactly as you've sad and read through github's SSH setup guide and I'm still getting the same error – ayeteo Dec 18 '17 at 06:52
  • 1
    Did you use the repo URL format as `git@github.com:username/repo.git`? Or can you show the command you used and the whole output here? – Marina Liu Dec 18 '17 at 06:56
  • Here is my exact input and output: `git clone git@github.com:userName/hrnyc-twittler.git Cloning into 'hrnyc-twittler'... /Users/userName/.ssh/config: line 2: Bad configuration option: st /Users/userName/.ssh/config: terminating, 1 bad configuration options fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.` – ayeteo Dec 18 '17 at 07:01
  • 2
    Please delete the config file `/Users/userName/.ssh/config` and try again. After generate ssh key, it only generate thge three files: `id_rsa`, `id_rsa.pub` and `known_hosts`. The `config` file is mainly you added manually before. – Marina Liu Dec 18 '17 at 07:15
  • Delete the file on my local machine or from github ? If local machine - how do I do that ? – ayeteo Dec 18 '17 at 07:30
  • 1
    in your local machine. The `config` file is located under `/Users/userName/.ssh` directory. So just find the file and delete it in your local machine, and then clone again. – Marina Liu Dec 18 '17 at 07:35
  • I feel really dumb. I cant find it anywhere – ayeteo Dec 18 '17 at 07:42
  • 1
    Uhm, but based on the output of your git clone command, seems you have the config file: `/Users/userName/.ssh/config: line 2: Bad configuration option: st ...`. Did you change it as a hidden file? – Marina Liu Dec 18 '17 at 07:46
  • No I never changed it. I can't find it searching the my files nor does it show up in my spotlif – ayeteo Dec 18 '17 at 07:47
  • Finally got it to work ! Thank you so much for your patience and help – ayeteo Dec 18 '17 at 08:11
  • 1
    Since you problem has been solved, you can mark the answer. And it will also benefit others who have similar questions :) – Marina Liu Dec 18 '17 at 08:22