Getting "Server refused to allocate pty" error when trying to connect to Bitbucket via SSH on Windows - windows

I'm trying to hook up Mercurial to Bitbucket on a PC and it's being really tough. I followed the instructions here:
http://www.codza.com/mercurial-with-ssh-setup-on-windows
and I'm running pageant set to my private key. I typed this at the command line:
plink -v hg#bitbucket.org and I get the following output:
C:\mypath>plink -v hg#bitbucket.org
"skipped for briefness"
Access granted
Opened channel for session
Server refused to allocate pty
Started a shell/command
conq: invalid command syntax
Server sent command exit status 0
Disconnected: All channels closed
My friend got the same error when he tried it on his PC. Can you help explain what the problem is or how to debug?
Running plink ssh://hg#bitbucket.org gives Using username ssh://hg and Disconnected: No supported authentication methods available.
Thanks for your help,
Kevin

You cannot connect to Bitbucket like that and get a login shell -- their backend process (called conq) will only accept Mercurial commands. With TortoiseHg, you don't have to do anything special -- so hg push ssh://hg#bitbucket.org/... should just work out of the box.
Using HTTPS is generally a nicer option for Bitbucket and as we discussed on IRC, there are plenty of ways to cache the passwords.

Related

Trouble connecting to Git server (bitbucket.org) via Win 10 Git Bash

I had to restart my machine but things were working before hand. I was using Git Bash with SSH and hoses on Win 10 to connect to BitBucket which was fine.
I then had to also connect with Git Bash (another instance) to GitHub. This required Putty and Pagent to get setup.
No I try to connect to BitBucket and get this:
git pull origin mybranch
FATAL ERROR: No supported authentication methods available (server sent: publickey)
fatal: Could not read from remote repository.
Is there a simple way to have both working in different shells?
I tried to do a plink.exe to bitbucket.org but that made things worse.
Is there a simple way to have both working in different shells?
Yes. You can use any single method (from both) for connecting to HG|BB. Just select preferred way (ssh + ssh-agent OR pageant) and perform needed steps according to relevant docs

SSH Host Key Rsync Issue

I have a bash script which uses rsync to pull down backups of my server to an offline server I have running Ubuntu.
But it does not seem my offline server wants to run this script right. And the issue I get when I run it manually run it is,
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(226) [Receiver=3.1.1]
But heres the thing, the host key is fine and works when I SSH. So logging on to my offline server and from there logging into the remote server works without any issues.
Here is where the issue gets very odd, the bash script works (when asked to run via webmin) after I have SSHed into the offline server. I dont have to do anything else, just login to the remote server and the bash script will work.
That is what I dont understand, if the host keys are not configured right, then they should not work at all, but they do, once I have logged into the server?
Thanks,
Try to login with ssh -a to prevent your ssh-agent to be forwarded. You probably use an identiy in your agent to authenticate to the target Server. This authentication will not work if your ssh-agent ist not present.

Git with putty on windows

When attempting to push / pull over ssh, git is failing with the following error:
"C:\Program Files\Git\bin\git.exe" push -u --recurse-submodules=check -progress "testremote" project:project
Using username "git-receive-pack 'ec2-user".
FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Done
The remote "testremote" is setup as "ssh://ec2-user#sweeb.net:gittest.git" and I'm using an existing keypair that I have used with PuTTY before without issue.
Pageant is running, with my key loaded.
I think the issue is the line "Using username "git-receive-pack 'ec2-user"." - I assumed git's commands were breaking on windows thanks to the space in "Program Files" so I've tried to surround everything with double quotes, but that doesn't seem to be working. Has anyone seen anything like this before?
Windows vars:
GIT_SSH=C:\PuTTY\plink.exe
PATH=[...];"C:\Program Files\Git\cmd";"C:\Program Files\Git\libexec\git-core\";"C:\Program Files\Git\bin\"
This was solved by removing "ssh://", that's implicit in Git Extensions apparently.

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.

Git Setup on Windows

So on my friends local Windows machine we are trying to setup GIT.
Basically, we've been following this guide which has been great. The problem we are facing is as follows:
All works until we get to Using Gitosis
When we use the command
git clone
git#INSERT_IP_HERE:gitosis-admin.git
We keep getting
Initialized empty Git repository in
/home/Thomas/gitosis-admin/.git
Connection closed by IP_HERE fatal:
The remote end hung up unexpectedly
When we try simply
ssh git#IP_HERE
We get "Connection closed by IP_HERE"
If we login as
runas /user:git C:/cygwin/cygwin.bat
And run > ssh git#IP_HERE
We at least get asked for a password then
Last Login: Connection to IP_HERE
closed.
Would anyone be able to help ?
The error does indeed indicate that authentication is failing.
Firstly, open gitosis.conf on the server and check that you are a member of the group containing gitosis-admin repository. It should show something like.
[gitosis]
[group gitosis-admin]
writable = gitosis-admin
members = user1 user2
The member name must match with a public key in /keydir before access can be made.
Secondly, you do not say how you are connecting from the Windows machines. If you are using Git under Cygwin, make sure you are correctly loading the private key. If you are using MsysGit with Putty, be sure to load the private key before connecting as well.
There is a small gotcha if PuttyGen is used to generate key pairs, and that is the default format is different from OpenSSH which you are probably using. Copy and paste from the top window, or alternatively edit the multiline public key file to read like this.
ssh-rsa AAAABB...KEYBODY...ONLkQ== user1
Lastly, make sure port 22 is open in any firewalls if that is indeed the port you are using.
A more comprehensive description of how to set up a Git server with Gitosis on Windows, can be found at here
I recommend the use of MsysGit from windows, as it gives better integration into the Windows environment. TortoiseGit and GitExtensions both use MsysGit as the backend, and provide nice Gui's and explorer shell extensions. GitExtensions full installer will provide the windows user with everything they need.
Did you get past runnig the gitosis-init < /tmp/id_rsa.pub command?
That error indicates to me that the public key isn't set up properly. The command above initializes gitosis with the first key.

Resources