Git on Windows fails to push local branch - windows

I installed Git Client in Windows and have created a initial branch locally. Currently I am trying to push the first version to the Git Server. But it does not get through successfully. I received the following error message:
Pushing to git#(my_git_server).git
FATAL ERROR: Network error: Connection timed out
fatal: The remote end hung up unexpectedly
Here is what I did for the setup:
Generate public and private key:
ssh-keygen -t rsa -C "(my email id)"
Copy the public key to Git server
Use KeyGen.exe to convert open ssh key to Putty private key
Load the private key with pageant.
Try to push the local branch to the server. (Failed)
I tried to SSH to the git Server and received the following error message:
server unexpected closed network connection.
Please kindly help me out.

Related

Can't clone git from GitLab in Windows

I have a problem only with one repository from my GitLab. I think it depends on the count of objects on the repository. Smaller projects were cloned successfully. Https doesn't work neither Linux nor Windows. In Windows I get the error:
........................................
........................................
remote: Counting objects: 100% (988/988)
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: protocol error: bad pack header
I also tried to clone the repository in my LAN network (ping < 1 ms). Same issue.
In Linux, I can clone the repository via ssh. But in Windows with the same private key, I get error about Invalid format in the private key. Key is the same as loaded in Linux OS. But if I tried to connect via ssh to GitLab (git#git.domain) the connection will be (Just ssh without git clone). I even see the welcome message.
The solution is a workaround in https://github.com/PowerShell/Win32-OpenSSH/issues/1315.

Problem cloning bare repository from windows 10 git server to windows 7 client: does not appear to be a git repository

I created a bare repository on windows 10 workstation which is attached to company private network
cd c:\users\remoteusername\gitserver
mkdir myrepo.git
cd myrepo.git
git init --bare --shared=group
Thereafter I setup an ssh server on this windows server using Win32_OpenSSH
On my windows 7 client, I first create a pair of public/private ssh keys from git shell and added it to ssh-agent:
cd c:\users\localusername\.ssh\
ssh-keygen.exe -t ed25519
eval `ssh-agent -s`
ssh-add.exe id_ed25519
This generated public/private key pair id_ed25519.pub and id_ed25519 on my windows 7 client machine.
Then I copied the contents from public key id_ed25519.pub to file c:\users\remoteusername.ssh\authorized_keys on windows 10 server which hosts my bare git repository.
I restart ssh daemon on the windows 10 server
net stop sshd
net start sshd
hello
Next, on my windows 7 client, I connect to my companies private network through VPN. I first check if I could connect from my Windows 7 client to Windows 10 machine via ssh using my remoteusername:
ssh remoteusername#myorg.com
I was successfully able to connect using my remoteusername. However, if I used 'git' as user name with ssh, I can't connect:
ssh git#myorg.com
git#myorg.com's password:
Permission denied, please try again.
Next I try to clone my remote repository on my local machine but it fails:
git clone ssh://remoteusername#myorg.com/C:/Users/remoteusername/gitserver/myrepo.git testrepo
Cloning into 'testrepo'...
remoteusername#myorg.com's password: 'git-upload-pack' is not recognized as an internal or external command,
operable program or batch file.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
To resolve error with unrecognized command 'git-upload-pack', on my Windows 10 server, I added paths of git sub-folders with binaries to my environment PATH variable:
C:\Users\remoteusername\AppData\Local\Programs\Git\bin
C:\Users\remoteusername\AppData\Local\Programs\Git\mingw64\bin
I again try to clone my remote repository on my local machine but it fails with a different error:
git clone ssh://remoteusername#myorg.com:/C/Users/remoteusername/gitserver/myrepo.git testrepo
Cloning into 'testrepo'...
remoteusername#myorg.com's password:
fatal: ''/C/Users/remoteusername/gitserver/myrepo.git'' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Anyone knows what is that I am missing and how to resolve this ?

Jenkins/Git on Windows - cannot clone on master but can clone on slave

I have the following setup:
Server A
Running Windows 7, 64 bit
Jenkins master as the Local System account.
Server B
Running Windows 7, 64 bit
A slave of the Jenkins master.
The agent is running as a dedicated user LOGON\jenkins.
We are using SSH to access GitHub - this is a requirement we can't change.
We are using the GitHub plugin.
If I initiate a Build on the Windows slave, the slave is able to clone a Git repository successfully.
If I initiate a Build on the Master, I get this error message:
Failed to connect to repository : Command "C:\Program Files\Git\cmd\git.exe ls-remote -h git#github.com:MY-PRJ/MY-REPO.git HEAD" returned status code 128:
stdout:
stderr: my-userid#github.build.ge.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
but the same Build works on the Slave.
Obviously a SSH key issue on the master - but where to look?

git clone SSL protocol error

I am trying to clone a git from a remote server in windows 7.
curl -v https://myserver
works git clone I get a:
fatal: unable to access 'https://myserver': Unknown SSL protocol error in connection to myserver:8080
another user using my computer was able to do it though. It's only my account that doesn't work?
any ideas?
thanks

Cannot clone git repo from ubuntu server with TortoiseGit

I'm facing some problems while git clone a repo from my ubuntu server running gitolite.
First, I got a public key from the developer who wants to clone the repository from the server. It was a rsa key created with putty. So I did the following to parse it from the putty-style to openssh format with:
ssh-keygen -i -f /tmp/ssh2/YourName.pub > /tmp/openssh/YourName.pub (taken from http://gitolite.googlecode.com/git/doc/ssh-troubleshooting.mkd?r=d3a663d03f1027f909732d55d0519bdd84edb62c)
and uploaded the public key along with a new entry for the repo and the new user in the config file to gitolite-admin repo.
So far, so good.
The developer is using **** along with putty to connect to the server, which is running git on a non-standard port and he keeps on getting the same error over and over again:
Cloning into 'D:\path\to\dirctory'...
error: Recv failure: Connection was reset while accessing http://sub.domain.com/info/refs
fatal: HTTP request failed
git did not exit cleanly (exit code 128)
Could anyone give me some advice about this issue?
EDIT:
In the meantime, we managed to git clone the repository by addressing it with the ssh:// protocol instead of git://, so it doesn't seem like it is a problem of the rsa_public.key or something like that.
The iptables on the server are accepting connections through the port for git, but it keeps on giving the above mentioned error.
The OP herom initially commented that the developer used git://git#remote.server.com:port/repo.git as an address.
I asked if there was any firewall issue, preventing the use of the git port (9418), but the OP mentioned:
no, there shouldn't be a firewall issue as iptables is accepting traffic for the git port - the port is forwarded and appears to be another port when connecting from outside...
Now, the developer cloned the repo through ssh:// (and even connecting to the ssh-port!)
I note that the git port can sometime be blocked, as illustrated in this thread.
If not on the client side, maybe on the server side.

Resources