Why would git-upload-pack (during git clone) hang? - windows

I've read several other 'git hangs on clone' questions, but none match my environment and details. I'm using git built under cygwin (msys git is not an option) to clone a repo from a Linux host over SSH.
git clone user#host:repo
I've tested against the same host on other platforms, and it works fine, but on this Windows machine the clone hangs indefinitely. I set GIT_TRACE=1 and it looks like the problem is with this command:
'ssh' 'user#host' 'git-upload-pack '\''repo'\'''
My SSH keys are set up correctly: ssh user#host works fine. When I run the command, I get a bunch of output that ends like this:
...
003dbbd3db63763922ad75bbeefa3811dce001576851 refs/tags/start
0000
Then it hangs for 20+ minutes, which is the longest I've waited before killing it.
The server has Git 1.7.11.7 with OpenSSH 5.9p1, while the client has Git 1.7.9 with OpenSSH 6.1p1.
Is that supposed to be the end of the git-upload-pack output? Is this a bug in Git or my configuration?

The upcoming git1.8.5 (Q4 2013) will document more the smart http protocol.
See commit 4c6fffe2ae3642fa4576c704e2eb443de1d0f8a1 by Shawn O. Pearce.
With that detailed documentation, the idea would be to monitor the web requests done between your git client and the server, and see if those conforms to what is documented below.
That could help in pinpointing where the service "hangs".
The file Documentation/technical/http-protocol.txt insists on:
the "Smart Service git-upload-pack"
Clients MUST first perform ref discovery with '$GIT_URL/info/refs?service=git-upload-pack'.
C: POST $GIT_URL/git-upload-pack HTTP/1.0
S: 200 OK
S: Content-Type: application/x-git-upload-pack-result
S: Cache-Control: no-cache
S:
S: ....ACK %s, continue
S: ....NAK
Clients MUST NOT reuse or revalidate a cached reponse.
Servers MUST include sufficient Cache-Control headers
to prevent caching of the response.
Servers SHOULD support all capabilities defined here.
Clients MUST send at least one 'want' command in the request body.
Clients MUST NOT reference an id in a 'want' command which did not appear in the response obtained through ref discovery unless the server advertises capability "allow-tip-sha1-in-want".
The "negociation" algorithm
(c) Send one $GIT_URL/git-upload-pack request:
C: 0032want <WANT #1>...............................

This worked for me, incase it helps someone else.
Check your git remote url. It might hang with git-upload-pack on a trace if your using the wrong url type. You change the url from ssh git#github.com: to https://github.com/ on your remote.

We have faced a similar issue - and we attributed it to the following: Our git repo has a LOT of binary files checked in (multiple versions, over the past 1.5 years of this project). So, we assumed that this was the cause.
To support this theory, we have other code bases that are more recent (and thus do not have so many binary files and their versions) - which do not exhibit this behavior.
Our setup: Git setup on linux, site-to-site VPN between London and India over a T1 line.

I was having this same problem after I added some jazz like this to my ssh config in order to set window titles in tmux:
Host *
PermitLocalCommand yes
LocalCommand if [[ $TERM == screen* ]]; then printf "\033k%h\033\\"; fi
getting rid of that fixed my git.

An outdated PuTTy can also cause this. Your system might be using plink.exe as GIT_SSH.
You can install the latest development build from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html to make sure this is not the problem.

My problem was simple. I updated the VPN client and git started hanging. I quit the VPN client and restarted it.

Related

ssh-add not saving identity after reboot - continues to fail after editing config file and trying numerous flag options

I have tried numerous options to add my ssh key for bitbucket to no avail.
When I reboot it ssh-add -L it says The agent has no identities.
I have tried using the following guides to add my ssh-key:
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/
I have tried several configurations of my config file including the following:
From BitBucket docs
Host *
UseKeychain yes
From Github docs
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/bitbucket
I tried using ssh-add -K ~/.ssh/bitbucket and ssh-add --apple-use-keychain ~/.ssh/bitbucket
I tried starting the agent 2 different ways
From BitBucket docs
eval `ssh-agent`
From GitHub Docs
eval "$(ssh-agent -s)"
When I run it, it works until I reboot. Sometimes it doesn't work when I switch terminals or use git operations in VSCode.
On reboot nothing works.
Looking for any solutions
I'm guessing from:
--apple-use-keychain
that you're on macOS (I added that to the tags). This matches up with another part of your question:
Sometimes it doesn't work when I switch terminals ...
There are two tricky bits that intertwine here:
It's possible to have more than one ssh-agent running (but generally you don't want this).
On macOS, when you boot up the system and log in—even before any Terminal windows open up—the system has started one ssh agent for you.
This second bullet point is specific to macOS. On other systems, it's usually the case that the system has not started an agent for you, and therefore you must start one. But on macOS the system has started one for you. You don't want to start a second one! So do not run eval `ssh-agent`.
If you do run it, you get a second agent, as requested, and then only that one Terminal window can talk to that agent. This results in other Terminal windows not working, as you observed, and could lead to other similar issues like the VSCode one, perhaps. (I don't use VSCode so this part is just a guess.)
You do have to run:
ssh-add ~/.ssh/bitbucket
or similar at least once; I do it after each reboot, to load the key into the agent. According to this question on apple.stackexchange.com, using -K will save the passphrase for the key, and on Sierra or later you must take an extra step as well; see that question and its answer for more.
(I switch OSes a lot so I tend to avoid depending too much on any one particular OS's features. The trick with Terminal and ssh-agent is actually kind of annoying, in that respect. 😀 But it is useful.)

ssh: Could not resolve hostname github.com + STATUS_ACCESS_VIOLATION at eip=68086014

Original question
From a few hours of struggling with installing git on Windows 7. First I installed the GitHub on Windows but not appealed to me. Then I installed the Git-1.9.2-preview20140411 and have started to have problems.
I suppose that there is a conflict by multiple installations. So I uninstalled everything. I decided to try Cygwin.
I acted according to this tutorial: How To install Git client on Windows using Cygwin By Johnathan Mark Smith
I added the generated public key SSH to my account on GittHub by Web browser . I created the first repository (through a browser).
After returning to the cygwin terminal and I typed:
git clone git#github.com:akawalko/ZFExt.git
I received such a result
Cloning into 'ZFExt'...
ssh: Could not resolve hostname github.com: Non-recoverable failure in name resolution
fatal: The remote end hung up unexpectedly
I do not understand this message. I did something wrong?
EDIT 1:
To the person who gave me the minus one. In your opinion I shouldn't have asked. Instead, format the hard drive. In this way it would be okay?
Updated question
I started to ask google with less detailed questions and i found it: git and ssh: Could not resolve hostname, ping works. I changed my DNS addresses to open DNS and was able to clone my repo by using ip adres instead domain:
git clone git#192.30.252.128:akawalko/ZFExt.git some_git_repo/
Using domain name still not work:
git clone git#github.com:akawalko/ZFExt.git some_git_repo/
Cloning into 'some_git_repo'...
ssh: Could not resolve hostname github.com: Non-recoverable failure in name resolution
fatal: The remote end hung up unexpectedly
Any ideas (other then changing DNS)?
I had this issue inside a VMware Fusion VM. I had to change my network from NAT to Bridged and it started working.
For anyone else having this issue on VMWare Fusion and Windows 10, see this thread: https://communities.vmware.com/thread/518949?start=0&tstart=0
In summary, ssh won't do dns resolution over NAT on Fusion with Windows 10. This is a known bug, but in the meantime, add an entry to your host file to access bitbucket
131.103.20.167 bitbucket.org
Also, as #Jim Redmond pointed out, bitbucket is changing their IP addresses soon (December 15, 2016).
Another, more permanent, option would be to set Google as your DNS provider. Use 8.8.8.8 or 8.8.4.4. Or for ipv6: 2001:4860:4860::8888 or 2001:4860:4860::8844. https://developers.google.com/speed/public-dns/docs/using
For me, it started happening when I upgraded to Git 2.7.4. The fix in the link below worked for me, you need to change SSH configuration in \etc\ssh\ssh_config.
AddressFamily inet
See the last comment in the thread linked below:
Can't resolve hostname with SSH
Summary
It's been a few days and I have not found any solution. In conclusion, it's more a problem with the operating system than the tools (Cygwin, Git).
I installed two competing Git clients (Git-1.9.2-preview20140411 and GitHub on Windows) which resulting in messed up windows registry. This gives in an error: STATUS_ACCESS_VIOLATION at eip=68086014. I returned to app GitHub For Windows and will use Windows Power Shell. It's far from perfect but it works.
I was so focused on problem mentioned above that I didn't spot problem with DNS. Because I don't have knowledge how to solve this problem (answers on stackoverflow didn't work for me) I will use the IP address instead of github domain in commands like git clone and others until I reinstall Windows. :-(
I have modified the title to more precise.
Big thanks to #Chris for his contribution.
I had the same problem .then I tried with account name prefixed in the domain.
like try
git clone git#youraccountname.github.com:akawalko/ZFExt.git
it worked for me also make sure in your git config you are using the same url.
Experienced the same problem with Windows 7 and VmWare Fusion 8.5.3.
Tried 2 options. Both worked. But issue is weird. Seem to happen to github.com and bitbucket.com only.
Setting DNS manually in adapter settings (e.g. 8.8.8.8)
Change networking from NAT to Bridged
For me it works fine when I changed the hostname to ip address.

Subversion EADDRINUSE on Mac

I have a subversion server (accessed by svn://server/directory) that I've been using for years from multiple Windows systems. I'm now doing some development on a Mac, and cannot get svn to access that server, even with a simple command such as
svn list svn://server/directory
(server and directory names change to protect the guilty)
All svn commands hang and have to be killed. (^c doesn't work, I have to ^z and kill...) Checking the console tool the last message is:
kernel: tcp_connect: inp=0xffffff801db54ac0 err=EADDRINUSE
Checking the server, the svnserve process is listening on port 3690. So I did a netstat -a on my mac, and there is nothing listed for port 3690.
That's the end of the hints I've found in a couple hours of searching. Any help would be greatly appreciated!
Thanks!
Solved! I have a DNS lookup problem. If I ping my server system, the address it tries to contact is not the IP address of that system. I added the hostname into my /etc/hosts table and voila! It now works.
Whew!

Cloning a repository results in a timeout

I upgraded my OS to Windows 7 and installed mercurial, but I can't seem to be able to clone any remote repository. Windows Firewall is disabled and I don't have a third-party firewall. I even tried to launch the command prompt as administrator. No matter what I do, I always get this Operation timed out error. Any ideas?
c:\Users\Alfred>hg clone http://bitbucket.org/jespern/django-piston/ hgrepo
abort: error: Operation timed out
Hrm, what does the output look like when you include --debug and --verbose?
Also, what happens if you clone over ssh using this command line?
hg clone ssh://hg#bitbucket.org/jespern/django-piston/ hgrepo
It works fine when I clone it just now. I guess Bitbucket simply had a small problem. In such a case, the best reaction is to log onto the #bitbucket IRC channel on irc.freenode.net -- StackOverflow is not a very good support forum, especially for transient problems like this.

SSH hangs on Mac Book Pro; AFS and Network Preferences?

I am having an issue with SSH hanging on my Mac Book Pro. This only happens to me once I get home from work after I have used SSH while at work. The three factors I have narrowed the issue down to are SSH, our work AFS network drive and the method of network connectivity.
At work we use an AFS drive with Kerberos Authentication to do all of our software development work on. I authenticate with Kerberos in order to gain access to the AFS drive where all my source code lives, but I open a local editor (Eclipse) which references the files on the AFS drive. Whenever I need to compile my code, I SSH in to my development server (which is also authenticated to the AFS drive) and compile from there. (Sanity Note: I know that it is a super wacky setup, but I promise I had NOTHING to do with it. I'm just making do with what I've got.)
For my Network Preferences, I use the Automatic location all the time. For that configuration I have Built-in Ethernet en1 configured to use DHCP and our company's DNS server for when I'm at work (there is no wireless available). When I go home I connect to my home network via wireless, again using DHCP.
I have a hunch that the AFS connection/Ethernet configuration is somehow the culprit here. Restarting the SSH daemon doesn't correct the problem. The only way I have found to correct the issue is by restarting the computer each time I want to use SSH. Keep in mind that I have no other (known) networking issues while at home after I've had the laptop at work.
I have a co-worker who has reported to me the same issue on his MBP.
I'm truly stumped on this one. Please provide some guidance. Thanks!
Can you be more specific about "SSH hanging"?
It sounds like your ssh client hangs after losing the connection and you are unable to do anything in the terminal. To get around this, you can use the ssh escape character (default: ‘~’) to begin an escape sequence, and use the the '.' to terminate the connection.
You can get a list of other ssh escape sequences using ~?, here's the one for OpenSSH SSH client:
Supported escape sequences:
~. - terminate connection
~B - send a BREAK to the remote system
~C - open a command line
~R - Request rekey (SSH protocol 2 only)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
If typing ~. does not work, it could be that you have the escape character disabled, in which case you can put
EscapeChar ~
inside ~/.ssh/config or /etc/ssh_config
Even when the escape character is disabled, you can simply pull up another Terminal window and type
killall ssh
to end all running ssh processes, allowing you to connect out again.
Restarting the SSH daemon would not correct this problem because sshd allows other clients to connect in to your machine, and does not affect your ssh clients connecting out to some other machine.
It appears that the fix for my issue is to delete my Kerberos tokens that are valid while at work, but not valid when at home. Hope this can help anyone having a similar issue.
Just a shot in the dark:
I recently had problems using ssh after installing Rogue Amoeba Audio Hijack Pro.
I could only use ssh as super user (sudo).
An Update to 2.8.1 resolved the issue...
Also see http://www.macobserver.com/article/2008/03/19.8.shtml for the issue.

Resources