Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git push fails within GNU screen

I can push just fine to my GitHub repo from my VPS, but once I enter a screen, I get permission denied:

littke@[server]:~/src/[repo]$ git push
Pushing to [email protected]:littke/[repo].git
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Even though I'm able to auth:

littke@[server}:~/src/[repo]$ ssh [email protected] -i ~/.ssh/littke 
Enter passphrase for key '/home/littke/.ssh/littke':
PTY allocation request failed on channel 0
Hi littke! You've successfully authenticated, but GitHub does not provide shell access.

Again, this only happens when inside a GNU Screen. I can push fine outside of it. I've googled but unable to find anything.

like image 716
Jonatan Littke Avatar asked May 13 '11 07:05

Jonatan Littke


People also ask

Why my git push is not working?

If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.

What is the meaning of git push origin feature screen 1?

The Git push command uploads local changes to your remote repository. Generally, when using Git, your code exists in both a local repository on your computer, as well as one or more repositories on a server.

How do you push origin master?

Whenever we need to push the changes to a remote repository, we use git push along with the remote repository “origin” and “master” branches. The term used is “git push origin master“. To pull the changes from the remote repository to local, we use git pull along with remote repository “origin” and “master” branch.

What is the git push command?

The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.


1 Answers

You're using a different identity file with ssh (the -i option) than git uses. You must tell git which identity to use, through your config. See github's Troubleshooting SSH issues, section "SSH config":

Create or open the file at ~/.ssh/config Add the following lines:

Host github.com
  User git
  Hostname github.com
  PreferredAuthentications publickey
  IdentityFile [local path]
like image 64
Fred Nurk Avatar answered Sep 28 '22 08:09

Fred Nurk