Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to Git-push master to Github - 'origin' does not appear to be a git repository / permission denied

This question is related to my problem in understanding rebase, branch and merge, and to the problem

How can you commit to your github account as you have a teamMate in your remote list?

I found out that other people have had the same problem. The problem seems to be related to /etc/xinet.d/.

Problem: unable to push my local branch to my master branch at Github

I run

git push origin master 

I get

fatal: 'origin' does not appear to be a git repository fatal: The remote end hung up unexpectedly 

The error message suggests me that the branch 'origin' is not in my local git repository. This way, Git stops connecting to Github.

This is strange, since I have not removed the branch 'origin'.

My git tree is

  dev * master   ticgit   remotes/Math/Math   remotes/Math/master   remotes/origin/master   remotes/Masi/master 

How can you push your local branch to Github, while you have a teamMate's branch in your local Git?


VonC's answer solves the main problem. I put a passphares to my ssh keys.

I run

$git push github master      

I get

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

It seems that I need to give the passphrase for Git somehow.

How can you make Github ask for your passphrase rather than relying on the ssh key?

like image 644
Léo Léopold Hertz 준영 Avatar asked May 28 '09 17:05

Léo Léopold Hertz 준영


People also ask

How do I fix Permission denied in git?

In terminal enter this command with your ssh file name pbcopy < ~/. ssh/id_rsa. pub This will copy the file to your clipboard Now open you github account Go to Settings > SSH and GPG keys > New SSH key Enter title and paste the key from clipboard and save it. Voila you're done.

Does not appear to be a git repository git push?

Note: The “fatal: 'origin' does not appear to be a git repository” error occurs when you try to push code to a remote Git repository without telling Git the exact location of the remote repository. To solve this error, use the git remote add command to add a remote to your project.

Can I push permission to denied GitHub?

GitHub's Permission denied (publickey) error is usually caused by one of the following three issues: You have used an incorrect email address in the GitHub SSH URL. You have not configured your public SSH key in your GitHub account. You must create GitHub SSH keys to be used by the secure shell.


2 Answers

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.

like image 126
VonC Avatar answered Oct 01 '22 18:10

VonC


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 
like image 41
Sarah Mei Avatar answered Oct 01 '22 18:10

Sarah Mei