简体   繁体   中英

Git hangs on push after Total

I have recently set up a VPS with Vultr and set up a remote git repository to upload my project.

After I add the remote to my local project and try to do the first push to it, it hangs after showing "Total 119 (delta 9), reused 0 (delta 0)".

To give a bit of context:

  • the server is a fresh setup of Ubuntu 17.04 x64
  • I have git version 2.14.1 locally
  • I have already done this before on another VPS with Vultr (Ubuntu 16.04 x64) and everything worked fine
  • The local git project is set up correctly as I have a remote on BitBucket where I could successfully push the project
  • I have already tried to increase the buffer size, as recommended on other similar questions
  • I am trying to upload a new, small Laravel project - no special or big files (every file is below 1MB)
  • I have updated my git version to the latest available version (from 2.12 to 2.14), as recommended on other similar questions
  • my SSH connection works fine and I have even set it up with Debug Level 3, so it is very verbose (I have the log below)
  • the remote repository seems to be set up correctly (I have tried to create an additional remote, pointing to a non-existing repo on the same server, using the same SSH connection and I get a proper error message from GIT that it can not find the repo)
  • I have set up the repo with and without --shared, but the result is the same
  • I have even waited (over 8 hours) and nothing happened, no error message, it was still hanging
  • I have tried every other solution I could find in 2 days on this topic and I still get the same result (even recreated my repo a few times, tried different names, tried chmod 777 for both my repo and my working directory on the server etc.)

Here is part of the verbose ssh output on git push (after it has verified the ssh keys):

debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to 45.63.116.43 ([45.63.116.43]:22).
debug2: fd 4 setting O_NONBLOCK
debug2: fd 5 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending command: git-receive-pack '/var/repo/hc-teaser.git'
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
Counting objects: 119, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (104/104), done.
Writing objects: 100% (119/119), 277.89 KiB | 5.91 MiB/s, done.
Total 119 (delta 9), reused 0 (delta 0)
debug2: channel 0: read<=0 rfd 4 len 0
debug2: channel 0: read failed
debug2: channel 0: close_read
debug2: channel 0: input open -> drain
debug2: channel 0: ibuf empty
debug2: channel 0: send eof
debug3: send packet: type 96
debug2: channel 0: input drain -> closed
debug2: channel 0: rcvd adjust 65689

After this last line it just hangs indefinitely.

The issue was bad target folder permissions. When I created the target folder, I used "sudo", so the owner was set to root. When I changed the target folder owner to my user (the one used to push the repo) and the group to www-data, everything worked like a charm.

So I've learnt that when git can't move the files from your repo to the target folder, because it doesn't have the proper authorisation, it doesn't show any error report, it just waits indefinitely.

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