简体   繁体   中英

Unable to push files to my github repository

I've set up git on my Ubuntu 12.04 LTS but whenever I try to push files to my remote repository ( git push -u origin master ), I get the following error-

ssh: connect to host github.com port 22: Connection timed out
fatal: The remote end hung up unexpectedly

What does this mean? and How can I fix it?


I installed Git using the following-

sudo apt-get install git

My local repository is here-

/media/48B9-FD83/foobar

it is not in the home directory, it is on a mounted drive (is that a problem?).

I initialized git in that directory and followed the steps given here - GitHub's official tutorial .

And when pushing the files, I get those ssh and fatal errors, mentioned above.

How can I fix this?

Try stuff in this order:

  • ping github.com . You should not see any timeouts.
  • sudo apt-get install telnet .
  • telnet github.com 22 . You should see something like this:

 Trying 204.232.175.90...
 Connected to github.com.
 Escape character is '^]'.
 SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze1+github9

  • Exit out of telnet by typing Ctrl + ] followed by Ctrl + d .
  • Follow steps mentioned in the Github: Generating ssh keys guide .
  • Make sure ~/.ssh and its contents are only readable to you by typing:

    • chmod 0755 ~/.ssh
    • chmod -R 0600 ~/.ssh/*
  • Next, ssh -T git@github.com should say:


Hi <username>! You've successfully authenticated, but GitHub does not provide shell access.

Report back if you see any error messages while trying any of these commands. Don't forget to post the error message you see in the comment.

Best of luck!

I had similar problems, always over WIFI, and I think I've found a after lots of searching. My solution is related to the Power Manager. You can check your settings by typing iwconfig in ther terminal and you should see something like this:

wlan0     IEEE 802.11bgn  ESSID:"MY_NET_NAME"  
          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:00:00:00:00:00   
          Bit Rate=52 Mb/s   Tx-Power=16 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=48/70  Signal level=-62 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:2  Invalid misc:27   Missed beacon:0

The problem is caused by Power Management:on (if yours is not on, this solution is not for you).

To disable power management off, type the following in your terminal (replacing wlan0 with your device):

sudo iwconfig wlan0 power off

This fixed my problems. To make the solution permanent, you can add the solution to power manager's startup:

  1. Create the script: sudo nano /etc/pm/power.d/wireless
  2. Copy paste the following: #!/bin/sh /sbin/iwconfig wlan0 power off
  3. Make the file executable sudo chmod u+x /etc/pm/power.d/wireless

Hopefully that helps.

This is based on info I found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM