Setting openssh port in windows for msysgit - windows

A quick question. I am using msysgit with openSSH as a git client. i don't want to use other ssh clients such as putty. From GIT Bash I have succesfully connected to my server with ssh -p XXXX to my sever.
Unfortunately when i try to do something like:
git clone git#SERVER:reponame.git
from the Git Bash I get:
ssh: connect to host SERVER port 22 failed.
How can I make the ssh connection that msysgit tries to open with openssh run at a different port?
I know that in linux such a thing would be in /etc/ssh/ssh_config file but how would I go about doing that in this case? Thanks in advance.

git supports the following syntax for ssh://
ssh://[user#]host.xz[:port]/path/to/repo.git/
Note the port in there.

Related

how to configure pycharm to ssh a bastion host using putty or OpenSSH

I am trying to ssh a bastion using pycharm PyCharm 2018.1 on a Windows 7 machine using putty.
I found some documentation to ssh a server and this work without any issues:
https://www.jetbrains.com/help/pycharm/tutorial-using-the-product-built-in-ssh-terminal-and-remote-ssh-external-tools.html
For the bastion server, it seems that pycharm doesn't allow such conection (in the config I only see login and server name as parameters). I tried to put in the putty configuration to the bastion server a tunnel to a localhost. On my window machine I see the port of my localhost.
The issue is that I don't manage to connect pycharm to the localhost. It expect a login and a pwd while I just have the localhost name.
I see in a post from last year that "if you are using a bastion host (also referred to as a jump host), you’ll be very happy to know that PyCharm 2017.3 supports SSH config files. Even on Windows."
https://blog.jetbrains.com/pycharm/2017/10/pycharm-2017-3-eap-5/
Any idea how to have it working either with the localhoast of using OpenSSH and SSH config file ?
The issue was the localhost.Using plink directly is working with no problem using same commands than regular ssh: plink.exe -L 9009:server:22 user#bastion. With Putty it doesn't work (first the IP was 0.0.0.0:port instead of 127.0.0.1:port even with the right port pycharm failed to connect with it work when I use plink directly).
This thread was helping: https://serverfault.com/questions/387772/ssh-reverse-port-forwarding-with-putty-how-to-specify-bind-address

How to specify ssh custom port in GitKraken on Windows?

I'm running a Gitkraken client on Windows 10. I've a remote GitLab (self-hosted) server listening SSH on port 2222. It seems, i can't use an SSH, whatever i tried to :
Clone Failed
Configured SSH key is invalid.
Please confirm that it is properly associated with your Git provider.
After some digging, it seems Gitkraken doesn't read my ssh config file witch specify my custom ssh port (Sourcetree works just fine).
How do I specify my ssh custom port in GitKraken ?

Adding ssh-keys in windows for private git

might be a dumb question.... but where do we add the ssh keys of the workstation to the git server both being purely on windows 2012 R2... ..Without the use of github
i had created a remote in the git server repo as
git remote add origin edscs-npe\bzky7x#IP:/c/temp/repo.git
In the workstation i am trying to clone the link as ..
$ git clone edscs-npe\bzky7x#IP:/c/temp/repo.git
Cloning into 'repo'...
ssh: connect to host "IP" port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Now the problem I think here is on the authentication between both the workstation and the git server... where do I add the ssh keys of the workstation to the git server both being windows machine...
Much help would be appreciated
Now the problem i think here is on the authentication between both the workstation and the git server...
To test this, just ssh from the workstation to the server. If it prompts you for a password and you are able to type it in and connect, then yes, you need to set up your ssh keys. If not, then there is more setup you need to do on the server end that is outside the scope of this question.
First, on your workstation you need to set up your public/private keys. You can do this with a command like:
ssh-keygen -t rsa
After hitting enter to accept the defaults, you should get some files in your ~/.ssh folder.
Now you need to add your public key to the authorized_keys on the server account you use for your git operations (You will need to enter a password for this operation)
cat ~/.ssh/id_rsa.pub | ssh user#server 'cat >> .ssh/authorized_keys'
You should be able to both interactively ssh into the server and use git to clone from the server.

Bash Ubuntu on Windows 10, connect to host port 22: Connection Failure

I just installed the Bash Ubuntu on Windows 10 natively. When I try and acess a remote server I get ssh: connect to host HOSTNAME port 22: Connection refused
I have tried to find a solutions, but the solutions doesn't work.
This is what I have tried:
https://askubuntu.com/questions/59458/error-message-sudo-unable-to-resolve-host-user/733120#733120
When I could not acess /etx/hosts I tried this:
https://askubuntu.com/questions/326239/cannot-access-etc-hosts
After downloading gksudo to try and edit /etc/hosts I got this error message (gksudo:2601): Gtk-WARNING **: cannot open display:
Are u sure everything is correctly setup?
I just tried
ssh -T git#github.com
in my Bash on Ubuntu on Windows.
and it totally works Returning
Hi <usernamer>! You've successfully authenticated, but GitHub does not provide shell access.
Maybe you have some settings that prevent connections? for example in ~/.bashrc?
Maybe your server needs a different port? use ssh -p 2222 for that.

How to push to heroku behind a proxy?

I am using git behind a proxy server at my university. While trying to execute
git push heroku master
I get an error
ssh: connect to host proxy.heroku.com port 22: Bad file number
fatal: The remote end hung up unexpectedly
I had a similar problem when pushing to git earlier, but that was solved using their smart HTTP. From what I've read so far, it seems to be a network problem. How do I fix this? Is there any way to push to heroku using HTTP? (I'm guessing pushing through SSH is causing this problem and that the port 22 is blocked)
Corkscrew is a tool for tunneling SSH through HTTP proxies
Setting up Corkscrew with SSH/OpenSSH is very simple. Adding
the following line to your ~/.ssh/config file will usually do
the trick (replace proxy.example.com and 8080 with correct values):
ProxyCommand /usr/local/bin/corkscrew proxy.example.com 8080 %h %p
Follow http://www.agroman.net/corkscrew/README
Heroku only supports git pushes over SSH (port 22) - it's likely that your university is preventing outbound port 22 access which causes your push to fail.

Resources