Unable to Git-push master to Github - 'origin' does not appear to be a git repository / permission denied
What does
$ git config --get-regexp '^(remote|branch)\.'
returns (executed within your git repository) ?
Origin is just a default naming convention for referring to a remote Git repository.
If it does not refer to GitHub (but rather a path to your teammate repository, path which may no longer be valid or available), just add another origin, like in this Bloggitation entry
$ git remote add origin2 [email protected]:myLogin/myProject.git
$ git push origin2 master
(I would actually use the name 'github' rather than 'origin' or 'origin2')
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Check if your gitHub identity is correctly declared in your local Git repository, as mentioned in the GitHub Help guide. (both user.name and github.name -- and github.token)
Then, stonean blog suggests (as does Marcio Garcia):
$ cd ~/.ssh
$ ssh-add id_rsa
Aral Balkan adds: create a config file
The solution was to create a config file under ~/.ssh/ as outlined at the bottom of the OS X section of this page.
Here's the file I added, as per the instructions on the page, and my pushes started working again:
Host github.com
User git
Port 22
Hostname github.com
IdentityFile ~/.ssh/id_rsa
TCPKeepAlive yes
IdentitiesOnly yes
You can also post the result of
ssh -v [email protected]
to have more information as to why GitHub ssh connection rejects you.
Check also you did enter correctly your public key (it needs to end with '==
').
Do not paste your private key, but your public one. A public key would look something like:
ssh-rsa AAAAB3<big string here>== [email protected]
(Note: did you use a passphrase for your ssh keys ? It would be easier without a passphrase)
Check also the url used when pushing ([email protected]/...
, not git://github.com/...
)
Check that you do have a SSH Agent to use and cache your key.
Try this:
$ ssh -i path/to/public/key [email protected]
If that works, then it means your key is not being sent to GitHub by your ssh client.
This is a problem with your remote. When you do git push origin master
, origin
is the remote and master
is the branch you're pushing.
When you do this:
git remote
I bet the list does not include origin
. To re-add the origin remote:
git remote add origin [email protected]:your_github_username/your_github_app.git
Or, if it exists but is formatted incorrectly:
git remote rm origin
git remote add origin [email protected]:your_github_username/your_github_app.git
VonC's answer is best, but the part that worked for me was super simple and is kind of buried among a lot of other possible answers. If you are like me, you ran into this issue while running a "getting started with rails" tutorial and you had NOT setup your public/private SSH keys.
If so, try this:
$>cd ~/.ssh
$>ls
If the output of ls is
known_hosts
and nothing else, visit: http://help.github.com/mac-key-setup/ and start following the instructions from the "Generating a key" section and down.
After running those instructions, my "git push origin master" command worked.
I have the same problem and i think the firewall is blocking the git protocol. So in the end I have to resort to using https:// to fetch and push. However this will always prompt the user to enter the password...
here is the example what working for me (just to share with those cant use git:// protocol :)
git fetch https://[user-name]@github.com/[user-name]/[project].git
if the above works, you can remove the origin and replace with
git remote rm origin
git remote add origin https://[user-name]@github.com/[user-name]/[project].git
I think that's another case of git error messages being misleading. Usually when I've seen that error it's due to ssh problems. Did you add your public ssh key to your github account?
Edit: Also, the xinet.d forum post is referring to running the git-daemon as a service so that people could pull from your system. It's not necessary to run git-daemon to push to github.