# Aliasing with parameters doesn't seem to work properly in git 1.7.0.5

4 messages from 2010-06-03 to 2010-06-03. Participants: Eugene Sajine, Jacob Helwig, Santi Béjar.
Thread: https://gitlist.dev/t/23993

## Eugene Sajine, 2010-06-03 14:52

Subject: Aliasing with parameters doesn't seem to work properly in git 1.7.0.5
Message-ID: <AANLkTilEZknW7m0n3y8SX5oAaZiUTorgqfX3jTB8mnDC@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTilEZknW7m0n3y8SX5oAaZiUTorgqfX3jTB8mnDC%40mail.gmail.com

```
Hi,

i'm trying to create an alias like this:

cln = !sh -c 'git clone git://server/"$1"'

the idea is to make a shortcut, so instead of command like this:

$git clone git://server/folder/repo.git

i can have something like this:

$git cln folder/repo.git

or even
$git cln folder/repo

if the alias is like this:
cln = !sh -c 'git clone git://server/"$1".git'

this doesn't work as it tries to initialize a repo called server.git
and then fails because "remote hang up unexpecedly"
is there something wrong in expansion of this alias or the alias
itself is not valid?

Any ideas?

Thanks,
Eugene

```

## Jacob Helwig, 2010-06-03 14:55

Subject: Re: Aliasing with parameters doesn't seem to work properly in git 1.7.0.5
Message-ID: <AANLkTikWBzHLCQzC57bZQwCB6MxOYS8R5Y-UBZoh_ndS@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikWBzHLCQzC57bZQwCB6MxOYS8R5Y-UBZoh_ndS%40mail.gmail.com
In-Reply-To: <AANLkTilEZknW7m0n3y8SX5oAaZiUTorgqfX3jTB8mnDC@mail.gmail.com>

```
On Thu, Jun 3, 2010 at 07:52, Eugene Sajine <euguess@gmail.com> wrote:
> Hi,
>
> i'm trying to create an alias like this:
>
> cln = !sh -c 'git clone git://server/"$1"'
>
> the idea is to make a shortcut, so instead of command like this:
>
> $git clone git://server/folder/repo.git
>
> i can have something like this:
>
> $git cln folder/repo.git
>
> or even
> $git cln folder/repo
>
> if the alias is like this:
> cln = !sh -c 'git clone git://server/"$1".git'
>
> this doesn't work as it tries to initialize a repo called server.git
> and then fails because "remote hang up unexpecedly"
> is there something wrong in expansion of this alias or the alias
> itself is not valid?
>
> Any ideas?
>
> Thanks,
> Eugene


You need " -" at the end of your alias for the parameters to get through.

Try using:

cln = !sh -c 'git clone git://server/"$1"' -

or

cln = !sh -c 'git clone git://server/"$1".git' -

```

## Santi Béjar, 2010-06-03 15:04

Subject: Re: Aliasing with parameters doesn't seem to work properly in git 1.7.0.5
Message-ID: <AANLkTilcESWIptCX3ZIVTrdI9JcC4XrHp9KTjR-jqzj7@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTilcESWIptCX3ZIVTrdI9JcC4XrHp9KTjR-jqzj7%40mail.gmail.com
In-Reply-To: <AANLkTilEZknW7m0n3y8SX5oAaZiUTorgqfX3jTB8mnDC@mail.gmail.com>

```
On Thu, Jun 3, 2010 at 4:52 PM, Eugene Sajine <euguess@gmail.com> wrote:
[...]

 so instead of command like this:
>
> $git clone git://server/folder/repo.git
>
> i can have something like this:
>
> $git cln folder/repo.git
>
> or even
> $git cln folder/repo

Then, you can the url.<url>.insteadof mechanism:

[url "<actual url base>"]
      insteadOf = <other url base>

       For example, with this:

[url "git://git.host.xz/"]
      insteadOf = work:

you can clone it with: git clone work:project.

See git-clone and/or git-config man page for more information.

HTH,
Santi

```

## Eugene Sajine, 2010-06-03 15:15

Subject: Re: Aliasing with parameters doesn't seem to work properly in git 1.7.0.5
Message-ID: <AANLkTik0438juR__hD87KJlqRTYOIyCncnwZ0hF1_tDC@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTik0438juR__hD87KJlqRTYOIyCncnwZ0hF1_tDC%40mail.gmail.com
In-Reply-To: <AANLkTikWBzHLCQzC57bZQwCB6MxOYS8R5Y-UBZoh_ndS@mail.gmail.com>

```
On Thu, Jun 3, 2010 at 10:55 AM, Jacob Helwig <jacob.helwig@gmail.com> wrote:
> On Thu, Jun 3, 2010 at 07:52, Eugene Sajine <euguess@gmail.com> wrote:
>> Hi,
>>
>> i'm trying to create an alias like this:
>>
>> cln = !sh -c 'git clone git://server/"$1"'
>>
>> the idea is to make a shortcut, so instead of command like this:
>>
>> $git clone git://server/folder/repo.git
>>
>> i can have something like this:
>>
>> $git cln folder/repo.git
>>
>> or even
>> $git cln folder/repo
>>
>> if the alias is like this:
>> cln = !sh -c 'git clone git://server/"$1".git'
>>
>> this doesn't work as it tries to initialize a repo called server.git
>> and then fails because "remote hang up unexpecedly"
>> is there something wrong in expansion of this alias or the alias
>> itself is not valid?
>>
>> Any ideas?
>>
>> Thanks,
>> Eugene
>
>
> You need " -" at the end of your alias for the parameters to get through.
>
> Try using:
>
> cln = !sh -c 'git clone git://server/"$1"' -
>
> or
>
> cln = !sh -c 'git clone git://server/"$1".git' -
>

This worked - thank you!!

Eugene

```
