# How can I append authentication with "git push" ?

7 messages from 2012-07-12 to 2012-07-16. Participants: J. Bakshi, Jeff King, Thiago Farina, Nick Douma, Junio C Hamano.
Thread: https://gitlist.dev/t/31006

## J. Bakshi, 2012-07-12 08:18

Subject: How can I append authentication with "git push" ?
Message-ID: <20120712134844.2d1c4378@shiva.selfip.org>
URL: https://gitlist.dev/e/20120712134844.2d1c4378%40shiva.selfip.org

```

Dear list,

Is there any option to add user-name and password with git push ?
Or any repo wise configuration file where I can save the info, so that
it doesn't ask the credential before every push ?

Thanks

```

## Jeff King, 2012-07-12 09:40

Subject: Re: How can I append authentication with "git push" ?
Message-ID: <20120712094040.GA5268@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120712094040.GA5268%40sigill.intra.peff.net
In-Reply-To: <20120712134844.2d1c4378@shiva.selfip.org>

```
On Thu, Jul 12, 2012 at 01:48:44PM +0530, J. Bakshi wrote:

> Is there any option to add user-name and password with git push ?

The username can go in the URL. For example:

  git push user@host:repo.git

for ssh, or:

  git push https://user@host/repo.git

for http.

For ssh, you can't specify a password automatically, but you should look
into using key authentication (which can then be cached by ssh-agent).
For http, you can put the password in the URL, but there are some
security implications (like the fact that your password will be
cleartext on disk, and visible in the process list to other users on the
system).

What protocol are you using to push?

> Or any repo wise configuration file where I can save the info, so that
> it doesn't ask the credential before every push ?

Older versions of git can read from .netrc, but I would not recommend
that, as it involves storing the password in plaintext on disk.

Newer versions of git (v1.7.9 and up) support "credential helpers" which
will read from a password wallet or other secure storage provided by the
OS. There is a helper for OS X Keychain in contrib/, and somebody has
been working on one for Windows.  What platform are you using?

-Peff

```

## Thiago Farina, 2012-07-12 15:04

Subject: Re: How can I append authentication with "git push" ?
Message-ID: <CACnwZYfbbZJV--aaOVH+af+Hxibg7XWvb909kZYWgKXVHexfDw@mail.gmail.com>
URL: https://gitlist.dev/e/CACnwZYfbbZJV--aaOVH%2Baf%2BHxibg7XWvb909kZYWgKXVHexfDw%40mail.gmail.com
In-Reply-To: <20120712134844.2d1c4378@shiva.selfip.org>

```
On Thu, Jul 12, 2012 at 5:18 AM, J. Bakshi
<joydeep.bakshi@infoservices.in> wrote:
> Or any repo wise configuration file where I can save the info, so that
> it doesn't ask the credential before every push ?
>
I'd like to know how to do that too.

It's a pain to have to type username and password every time I need to
push to github. (Linux here btw).

```

## Nick Douma, 2012-07-12 15:30

Subject: Re: How can I append authentication with "git push" ?
Message-ID: <4FFEEDB3.5060003@nekoconeko.nl>
URL: https://gitlist.dev/e/4FFEEDB3.5060003%40nekoconeko.nl
In-Reply-To: <CACnwZYfbbZJV--aaOVH+af+Hxibg7XWvb909kZYWgKXVHexfDw@mail.gmail.com>

```
Hi,

On 12-07-12 17:04, Thiago Farina wrote:
> On Thu, Jul 12, 2012 at 5:18 AM, J. Bakshi
> <joydeep.bakshi@infoservices.in> wrote:
>> Or any repo wise configuration file where I can save the info, so that
>> it doesn't ask the credential before every push ?
>>
> I'd like to know how to do that too.
> 
> It's a pain to have to type username and password every time I need to
> push to github. (Linux here btw).

If you're specifically looking at GitHub and HTTP auth, take a look at
the hub tool:

https://github.com/defunkt/hub

Kind regards,

Nick Douma


```

## Junio C Hamano, 2012-07-12 17:22

Subject: Re: How can I append authentication with "git push" ?
Message-ID: <7vpq80c2t1.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vpq80c2t1.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CACnwZYfbbZJV--aaOVH+af+Hxibg7XWvb909kZYWgKXVHexfDw@mail.gmail.com>

```
Thiago Farina <tfransosi@gmail.com> writes:

> On Thu, Jul 12, 2012 at 5:18 AM, J. Bakshi
> <joydeep.bakshi@infoservices.in> wrote:
>> Or any repo wise configuration file where I can save the info, so that
>> it doesn't ask the credential before every push ?
>>
> I'd like to know how to do that too.
>
> It's a pain to have to type username and password every time I need to
> push to github. (Linux here btw).

I never type either when pushing to github, and I've been pushing
there at least twice a day for quite some time (Linux here btw).

I have these in .git/config:

        [remote "github2"]
                url = https://github.com/git/git
                fetch = +refs/heads/*:refs/remotes/github2/*
                pushurl = github.com:git/git.git
                push = refs/heads/maint:refs/heads/maint
                push = refs/heads/master:refs/heads/master
                push = refs/heads/next:refs/heads/next
                push = +refs/heads/pu:refs/heads/pu

        [remote "github"]
                url = https://github.com/gitster/git
                pushurl = github.com:gitster/git.git
                mirror

and then this in $HOME/.ssh/config:

        Host github.com
                User git
                IdentityFile ~/.ssh/github

```

## J. Bakshi, 2012-07-16 08:25

Subject: Re: How can I append authentication with "git push" ?
Message-ID: <20120716135512.1a3ce06c@shiva.selfip.org>
URL: https://gitlist.dev/e/20120716135512.1a3ce06c%40shiva.selfip.org
In-Reply-To: <20120712134844.2d1c4378@shiva.selfip.org>

```

Any idea please ?

On Thu, 12 Jul 2012 13:48:44 +0530
"J. Bakshi" <joydeep.bakshi@infoservices.in> wrote:

> 
> Dear list,
> 
> Is there any option to add user-name and password with git push ?
> Or any repo wise configuration file where I can save the info, so that
> it doesn't ask the credential before every push ?
> 
> Thanks

```

## Jeff King, 2012-07-16 11:11

Subject: Re: How can I append authentication with "git push" ?
Message-ID: <20120716111105.GA4962@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120716111105.GA4962%40sigill.intra.peff.net
In-Reply-To: <20120716135512.1a3ce06c@shiva.selfip.org>

```
On Mon, Jul 16, 2012 at 01:55:12PM +0530, J. Bakshi wrote:

> Any idea please ?

Did you miss the four responses here:

  http://thread.gmane.org/gmane.comp.version-control.git/201351

?

-Peff

```
