threads / discuss / 25753

Setting up Git Server over SSH

Subject: Setting up Git Server over SSH

## tl;dr

5 messages between Nov 15, 2010 and Nov 17, 2010.

replies: 4people: 3as markdown or json

Dennis· Nov 15, 2010, 18:20 UTC · lore

I have a remote server (hostname.com) that acts as a webserver. What I did is I wanted to set up my public_html folder as a public repository. After trial and error I am still at stage_0.

Thus, on that server I have /home/user/.git directory and the repo works fine if I am accessing it from the server.

Now, I want to clone that repo onto my local machine. I am doing this, but it fails:

>git clone ssh://hostname.com:/home/user/.git

Cloning into user... fatal: protocol error: bad line length character: logi

>Access denied

Access denied Access denied Access denied Access denied Access denied FATAL ERROR: Server sent disconnect message type 2 (protocol error): "Too many authentication failures for " --------------------------------

What can I do to make it work? Dennis

Shawn Pearce· Nov 15, 2010, 18:38 UTC · re: Dennis · lore

Re: Setting up Git Server over SSH

On Mon, Nov 15, 2010 at 10:20 AM, Dennis <dennisfm@friendlymatch.com> wrote:
Show 6 quoted lines
> I am doing this, but it fails:
>
>> git clone ssh://hostname.com:/home/user/.git
>
> Cloning into user...
> fatal: protocol error: bad line length character: logi

This looks to me like your server is echoing back text upon login. That text is being confused for Git protocol data by the Git client, but its not as expected, so it aborts with an error message.

Try getting the simple case to work first:
  ssh hostname.com echo hello

This should *only* print "hello". If it prints anything else (and right now I suspect it prints "login ..."), that will confuse Git. You need to adjust your server's shell login scripts to stop echoing information during a non-interactive shell. Or you may need to adjust your SSH client to ensure the authentication proceeds smoothly. Those "Access denied" errors look like you aren't actually authenticating to the server.

-- 
Shawn.
Dennis· Nov 15, 2010, 19:14 UTC · re: Shawn Pearce · lore

Re: Setting up Git Server over SSH

Thanks, that worked

I used OpenSSH instead of Putty and that fixed things up.

Dennis
----- Original Message ----- 
From: "Shawn Pearce" <spearce@spearce.org>
To: "Dennis" <dennisfm@friendlymatch.com>
Cc: <git@vger.kernel.org>
Sent: Monday, November 15, 2010 1:38 PM
Subject: Re: Setting up Git Server over SSH
Show 27 quoted lines
> On Mon, Nov 15, 2010 at 10:20 AM, Dennis <dennisfm@friendlymatch.com> 
> wrote:
>> I am doing this, but it fails:
>>
>>> git clone ssh://hostname.com:/home/user/.git
>>
>> Cloning into user...
>> fatal: protocol error: bad line length character: logi
>
> This looks to me like your server is echoing back text upon login.
> That text is being confused for Git protocol data by the Git client,
> but its not as expected, so it aborts with an error message.
>
> Try getting the simple case to work first:
>
>  ssh hostname.com echo hello
>
> This should *only* print "hello".  If it prints anything else (and
> right now I suspect it prints "login ..."), that will confuse Git.
> You need to adjust your server's shell login scripts to stop echoing
> information during a non-interactive shell.  Or you may need to adjust
> your SSH client to ensure the authentication proceeds smoothly.  Those
> "Access denied" errors look like you aren't actually authenticating to
> the server.
>
> -- 
> Shawn. 
Ævar Arnfjörð Bjarmason· Nov 16, 2010, 10:46 UTC · re: Dennis · lore

Re: Setting up Git Server over SSH

On Mon, Nov 15, 2010 at 20:14, Dennis <dennisfm@friendlymatch.com> wrote:
> I used OpenSSH instead of Putty
> and that fixed things up.
Does using Putty with this at the top of your .bashrc fix it too:
    if [[ $- != *i* ]] ; then
        # Shell is non-interactive.  Be done now!
        return
    fi
?
Dennis· Nov 17, 2010, 02:25 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: Setting up Git Server over SSH

I reinstalled git package with putty and it worked okay this time. It did print this line though before normal output: stdin: is not a tty remote: Counting objects: 1194, done. ...

I tweaked bash setting and it did not seem to do anything. But then I am on Windows XP, so not sure if it will work the same way or if I edited the right file.

Dennis
----- Original Message ----- 
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Dennis" <dennisfm@friendlymatch.com>
Cc: "Shawn Pearce" <spearce@spearce.org>; <git@vger.kernel.org>
Sent: Tuesday, November 16, 2010 5:46 AM
Subject: Re: Setting up Git Server over SSH
Show 12 quoted lines
> On Mon, Nov 15, 2010 at 20:14, Dennis <dennisfm@friendlymatch.com> wrote:
>> I used OpenSSH instead of Putty
>> and that fixed things up.
>
> Does using Putty with this at the top of your .bashrc fix it too:
>
>    if [[ $- != *i* ]] ; then
>        # Shell is non-interactive.  Be done now!
>        return
>    fi
>
> ? 

← back to recent threads