Git and Github repository push error


I keep trying to push an existing repository on Github to the command line, but my terminal rejects it every time I get to “git push -u origin main.”

I’ve tried so many suggestions from stack overflow and I even tried creating & managing the SSH keys. Nothing! Still getting the following error message:

Can someone please help me? I would appreciate a live-walkthrough or help because I have been stuck on this for a week and can’t move forward in my career path. It’s frustrating :frowning:

Two things.

  1. Not quite sure why you’ve opted to use SSH with GitHub rather than using HTTPS, given that I’d say the latter is easier to use for beginners (or those unfamiliar with SSH, which I presume you are?). Is this the suggested method being taught in one of the Codecademy courses?

  2. GitHub doesn’t allow connections via SSH on port 22*. Sure, it’s the default port for SSH but it’s not the one GitHub is listening on. You need to use port 443.

Troubleshooting notes for using SSH to connect to GitHub are available here, you probably want the first one: “Using SSH over the HTTPS port”.

(* This is true for - private installations using GitHub Enterprise Server can likely configure SSH access on whatever port they like.)

So that;s the frustrating part. SSH has been my last resort because I’ve had so many failed attempts with HTTPS. thats what I started with :frowning:

Well I guess there’s always an exception which proves the rule. :smiley:

The link above should have instructions on how to tell SSH to use port 443 for connections to GitHub, which ought to fix your problem. :slight_smile: (It’s a small change to the SSH config file, takes about 2 minutes.)

Ive already tried to configure it to port 443 and im denied everytime. i honestly don’t know what i’m doing wrong and on the verge of a breakdown. any chance someone could look at it with me sojme time? live? so I can see what im doing wrong?

I’m presuming that you mean you’re denied every time you try and make the change to the SSH config? That would make more sense than you being denied when attempting to connect on port 443, given that your screenshot clearly shows that it is attempting the usual port 22.

Alterations to ~/ssh/.config may require elevated rights - if you’re using a *nix like system and are, say, using nano to make the change with nano ~/ssh/.config and are unable to save the change you may want to sudo it and see if you get any further along.