I have a project where every time I git push
to my GitHub account using SSH keys (on Windows), the command line hangs for several minutes, and then I eventually get the error Connection to github.com closed by remote host.
I can do git pull
or git fetch
successfully. I can also do ssh -T [email protected]
successfully.
I've been pushing successfully to this project for a while. I think this problem started when I switched to use OpenSSH as my SSH agent and configured it to use two different keys for different SSH accounts. However, I've disabled the separate keys (I renamed my .ssh\config
file) to test, and I still have the same problem.
I tried cloning this project to another location on my computer, updating it, and doing a git push
and that works correctly from the newly cloned repository.
Here are the results of git remote show origin
from my original repo.
* remote origin
Fetch URL: [email protected]:MyUserName/MyRepo.git
Push URL: [email protected]:MyUserName/MyRepo.git
HEAD branch: master
Remote branches:
develop tracked
master tracked
test new (next fetch will store in remotes/origin)
Local branches configured for 'git pull':
develop merges with remote develop
master merges with remote master
Local refs configured for 'git push':
develop pushes to develop (fast-forwardable)
master pushes to master (fast-forwardable)
Here are the results of git remote show origin
from my newly cloned repo. Note that the test
branch is a new branch that I created so I didn't overwrite master
.
* remote origin
Fetch URL: [email protected]:MyUserName/MyRepo.git
Push URL: [email protected]:MyUserName/MyRepo.git
HEAD branch: master
Remote branches:
develop tracked
master tracked
test tracked
Local branches configured for 'git pull':
master merges with remote master
test merges with remote test
Local refs configured for 'git push':
master pushes to master (up to date)
test pushes to test (up to date)
GIT_SSH_COMMAND="ssh -vvv" git push origin master
(or whatever branch) and edit your question to include the output?master
anddevelop
branch. Maybe the problem is with OpenSSH?