# Can I use git protocol to push change to remote repo?

5 messages from 2008-12-16 to 2008-12-16. Participants: Emily Ren, Jeff King.
Thread: https://gitlist.dev/t/16748

## Emily Ren, 2008-12-16 07:22

Subject: Can I use git protocol to push change to remote repo?
Message-ID: <856bfe0e0812152322i3a7fa376h8a35466b7abf82a5@mail.gmail.com>
URL: https://gitlist.dev/e/856bfe0e0812152322i3a7fa376h8a35466b7abf82a5%40mail.gmail.com
In-Reply-To: <856bfe0e0812152318h1375401fx944834ad6410835d@mail.gmail.com>

```
Hello,

I can clone a remote repo with git protocol, but I can't push my
branch to origin repo with git protocol. If I use ssh protocol, I can
push sccuessfully. I'm confused, can someone give me a guide on this?
Can I use git protocol to push my branch to remote repo? If yes, how
can I do ? Thank you for your help in advance !

Error info is as below:
 $ git push git://host.xz/testgit check_push
fatal: The remote end hung up unexpectedly
error: failed to push to 'git://host.xz/testgit'

Successful info with ssh protocol:
$ git push ssh://host.xz/testgit check_push
user's password:
updating 'refs/heads/check_push'
  from 0000000000000000000000000000000000000000
  to   60719ede9ef5d5fdc042e7aebcebc04a93d3928a
Generating pack...
Done counting 3 objects.
Deltifying 3 objects...
 100% (3/3) done
Writing 3 objects...
 100% (3/3) done
Total 3 (delta 0), reused 0 (delta 0)

Thanks,
Emily

```

## Jeff King, 2008-12-16 07:38

Subject: Re: Can I use git protocol to push change to remote repo?
Message-ID: <20081216073835.GA2468@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20081216073835.GA2468%40coredump.intra.peff.net
In-Reply-To: <856bfe0e0812152322i3a7fa376h8a35466b7abf82a5@mail.gmail.com>

```
On Tue, Dec 16, 2008 at 03:22:17PM +0800, Emily Ren wrote:

> I can clone a remote repo with git protocol, but I can't push my
> branch to origin repo with git protocol. If I use ssh protocol, I can
> push sccuessfully. I'm confused, can someone give me a guide on this?
> Can I use git protocol to push my branch to remote repo? If yes, how
> can I do ? Thank you for your help in advance !

Yes, git-daemon does not support pushing by default, since it doesn't do
any authentication of the pushing users. The recommended practice is to
push over ssh, which uses the exact same protocol, but is tunneled over
ssh, so the user is authenticated and the incoming data has an integrity
check (note that pulling by ssh is also the same protocol as pulling via
git://, except of course that it is also tunneled over ssh; this means
that if you are pushing and pulling, you can just set your remote to
talk to the ssh version).

If you _really_ want totally anonymous, unsecured pushing to your repo
(e.g., because you are on a restricted LAN and everybody is trusted),
you can enable the receive-pack service. See the git-daemon
documentation for details.

-Peff

```

## Emily Ren, 2008-12-16 08:48

Subject: Re: Can I use git protocol to push change to remote repo?
Message-ID: <856bfe0e0812160048l7d901658tca96f5055c69743c@mail.gmail.com>
URL: https://gitlist.dev/e/856bfe0e0812160048l7d901658tca96f5055c69743c%40mail.gmail.com
In-Reply-To: <20081216073835.GA2468@coredump.intra.peff.net>

```
Peff,

Thank you for your help !  I read the git-daemon description, and
added following lines in the config file of remote repository.

 [daemon]
       receivepack = true

It failed with another error, is there anything I missed to config daemon ?
$ git push git://host.xz/testgit test_push2
updating 'refs/heads/test_push2'
  from 0000000000000000000000000000000000000000
  to   eebb60caae38a38361d002cdace043124a2fc871
Generating pack...
Done counting 3 objects.
Deltifying 3 objects...
 100% (3/3) done
Writing 3 objects...
 100% (3/3) done
Total 3 (delta 0), reused 0 (delta 0)
unpack unpacker exited with error code
ng refs/heads/test_push2 n/a (unpacker error)
error: failed to push to 'git://host.xz/testgit'

Thanks,
Emily

On Tue, Dec 16, 2008 at 3:38 PM, Jeff King <peff@peff.net> wrote:
> On Tue, Dec 16, 2008 at 03:22:17PM +0800, Emily Ren wrote:
>
>> I can clone a remote repo with git protocol, but I can't push my
>> branch to origin repo with git protocol. If I use ssh protocol, I can
>> push sccuessfully. I'm confused, can someone give me a guide on this?
>> Can I use git protocol to push my branch to remote repo? If yes, how
>> can I do ? Thank you for your help in advance !
>
> Yes, git-daemon does not support pushing by default, since it doesn't do
> any authentication of the pushing users. The recommended practice is to
> push over ssh, which uses the exact same protocol, but is tunneled over
> ssh, so the user is authenticated and the incoming data has an integrity
> check (note that pulling by ssh is also the same protocol as pulling via
> git://, except of course that it is also tunneled over ssh; this means
> that if you are pushing and pulling, you can just set your remote to
> talk to the ssh version).
>
> If you _really_ want totally anonymous, unsecured pushing to your repo
> (e.g., because you are on a restricted LAN and everybody is trusted),
> you can enable the receive-pack service. See the git-daemon
> documentation for details.
>
> -Peff
>

```

## Jeff King, 2008-12-16 08:52

Subject: Re: Can I use git protocol to push change to remote repo?
Message-ID: <20081216085205.GB3031@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20081216085205.GB3031%40coredump.intra.peff.net
In-Reply-To: <856bfe0e0812160048l7d901658tca96f5055c69743c@mail.gmail.com>

```
On Tue, Dec 16, 2008 at 04:48:34PM +0800, Emily Ren wrote:

> It failed with another error, is there anything I missed to config daemon ?
> $ git push git://host.xz/testgit test_push2
> updating 'refs/heads/test_push2'
>   from 0000000000000000000000000000000000000000
>   to   eebb60caae38a38361d002cdace043124a2fc871
> Generating pack...
> Done counting 3 objects.
> Deltifying 3 objects...
>  100% (3/3) done
> Writing 3 objects...
>  100% (3/3) done
> Total 3 (delta 0), reused 0 (delta 0)
> unpack unpacker exited with error code
> ng refs/heads/test_push2 n/a (unpacker error)
> error: failed to push to 'git://host.xz/testgit'

Does the user running git-daemon have permissions to write to the repo?

-Peff

```

## Emily Ren, 2008-12-16 08:59

Subject: Re: Can I use git protocol to push change to remote repo?
Message-ID: <856bfe0e0812160059k102cd6a7k8d551f9d20010d62@mail.gmail.com>
URL: https://gitlist.dev/e/856bfe0e0812160059k102cd6a7k8d551f9d20010d62%40mail.gmail.com
In-Reply-To: <20081216085205.GB3031@coredump.intra.peff.net>

```
Peff,

Yes, you are  right !  I changed the permission of the repo, and it's OK now. :)

Thank you very much for your kindly help !

Emily

On Tue, Dec 16, 2008 at 4:52 PM, Jeff King <peff@peff.net> wrote:
> On Tue, Dec 16, 2008 at 04:48:34PM +0800, Emily Ren wrote:
>
>> It failed with another error, is there anything I missed to config daemon ?
>> $ git push git://host.xz/testgit test_push2
>> updating 'refs/heads/test_push2'
>>   from 0000000000000000000000000000000000000000
>>   to   eebb60caae38a38361d002cdace043124a2fc871
>> Generating pack...
>> Done counting 3 objects.
>> Deltifying 3 objects...
>>  100% (3/3) done
>> Writing 3 objects...
>>  100% (3/3) done
>> Total 3 (delta 0), reused 0 (delta 0)
>> unpack unpacker exited with error code
>> ng refs/heads/test_push2 n/a (unpacker error)
>> error: failed to push to 'git://host.xz/testgit'
>
> Does the user running git-daemon have permissions to write to the repo?
>
> -Peff
>

```
