Can not get SSH on Mac to Push Error

git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree commit -q -F /var/folders/n3/cywwjctx7_x37l3ld53bc7v00000gn/T/SourceTreeTemp.d9aWdm

git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags --set-upstream github refs/heads/master:refs/heads/master

Pushing to ssh://github.com/Lou109/Text101.git

/Users/louisecollins/.ssh/config line 4: garbage at end of line; “*”.

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

Completed with errors, see above

I did manage to get previous key to work on previous 2 projects but when added 3rd project SSH would not push. Even created a new key. Very frustrating. Can i not just HTTPS or is this not an option on the mac ? In that case would i be better off just using PC as this is a total pain.

1 Like

From the error, it looks like there is a parsing problem in your ssh config file on line 4: ~/.ssh/config

Can you share the contents through line 4?

I dont know where line 4 is or how to access it sorry

I created a new key yet again but then got this when i pushed repository

git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags github refs/heads/master:refs/heads/master

Pushing to ssh://github.com/Lou109/GitHub-Course.git

Lou109@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

Pushing to ssh://github.com/Lou109/GitHub-Course.git

Lou109@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

Pushing to ssh://github.com/Lou109/GitHub-Course.git

Lou109@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

Pushing to ssh://github.com/Lou109/GitHub-Course.git

Lou109@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

Completed with errors, see aboveCompleted with errors, see above

Got it working on the 4th attempt

Glad you got it working.

The ssh config file is used to specify a different key pair other than the default id_rsa one that is created by ssh-keygen and to specify which host (like github vs bitbucket etc) to use it for. This avoids needing to use the “-i” option at the command line each time to toggle between multiple keys or force you to use the same keys for each site. If you don’t have multiple keys for different sites then you shouldn’t need an ssh config file. Another use is for ssh access to a server or ssh tunneling or port forwarding but that’s not needed for public git repositories. The file resides in your home directory and can be printed quickly from the terminal via cat ~/.ssh/config

Your problem may have been due to not having the full public key that you generated in ~/.ssh/id_rsa.pub copied exactly into your github account ssh keys section.

You can still use https access with git but I’d recommend against it as it passes your username/password each time you execute a git command. It is over a secure connection (TLS) but public/private key access is a stronger form of authentication and keeps your main login credentials separate and easy to revoke or regenerate. It is also more convenient once you have it set up as you never need to worry about putting in your creds again when interacting with git. The credentials helper caches the credentials for a period of time but is still passing it to github each time behind the scenes.

2 Likes

thanks tryfinsigabrt

1 Like

yeh problems come back. I can only seem to push on a couple of projects. Anymore and the errors come back.

sorted it ! Git Clone then paste in SHH code after all the other stuff :sweat_smile:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms