1

I have registered the ssh key for my machine on github and verified that it works by typing ssh [email protected] and receiving a response indicating successful authentication.

However, when I try and push my source code on the machine to my git repository I receive

Permission denied (publickey). fatal: The remote end hung up unexpectedly 

I have looked at other threads with the same problem as me and they all seem to recommend registering the ssh key with github which I have already done.

Edit: The contents of my .git/config file on my workstation

[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = ssh://github.com/OSU-Net/list_expiration [branch "master"] remote = origin merge = refs/heads/master 

Any ideas?

2
  • 1
    Did you add a remote? What do you see when you type git remote -v Commented Aug 4, 2014 at 21:38
  • Yes. They both point to the url of my github repository origin ssh://github.com/my_repository_dir (fetch) origin ssh://github.com/my_repository_dir (push) Commented Aug 4, 2014 at 21:43

1 Answer 1

1

The url line for the origin remote appears to be missing a username. The reason why you are getting Permission Denied is because SSH is defaulting to your local system username, since none was specified. Unless your local username happens to be identical to the remote username, it will reject the login as your public key is not associated with an account by that name.

The remote URL should either be in the format ssh://<username>@<hostname>/path/to/git/repo/, or in Github's case, [email protected]:<username>/<repo name>.git.

You can change your origin url with the following command:

git remote set-url origin [email protected]:OSU-Net/list_expiration.git 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.