git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to provide authentication along with git command itself ?
@ 2011-07-14 10:45 J. Bakshi
  2011-07-14 10:50 ` Carlos Martín Nieto
  2011-07-14 10:53 ` Jon Seymour
  0 siblings, 2 replies; 7+ messages in thread
From: J. Bakshi @ 2011-07-14 10:45 UTC (permalink / raw)
  To: git

Hello list,

During git push or fetch over http , I need to provide username and password every time, as protected by apache htpasswd file. How can I provide the same along with git command ? Or something so that It save the authentication info somewhere within .git 

Thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to provide authentication along with git command itself ?
  2011-07-14 10:45 How to provide authentication along with git command itself ? J. Bakshi
@ 2011-07-14 10:50 ` Carlos Martín Nieto
  2011-07-14 10:59   ` J. Bakshi
  2011-07-14 10:53 ` Jon Seymour
  1 sibling, 1 reply; 7+ messages in thread
From: Carlos Martín Nieto @ 2011-07-14 10:50 UTC (permalink / raw)
  To: J. Bakshi; +Cc: git

On Thu, 2011-07-14 at 16:15 +0530, J. Bakshi wrote:
> Hello list,
> 
> During git push or fetch over http , I need to provide username and
> password every time, as protected by apache htpasswd file. How can I
> provide the same along with git command ? Or something so that It save
> the authentication info somewhere within .git 

The http transport uses the ~/.netrc file to get its authentication
data.  `man netrc` will tell you about the syntax; for git, you need the
'machine', 'login' and 'password' fields.

Cheers,
   cmn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to provide authentication along with git command itself ?
  2011-07-14 10:45 How to provide authentication along with git command itself ? J. Bakshi
  2011-07-14 10:50 ` Carlos Martín Nieto
@ 2011-07-14 10:53 ` Jon Seymour
  2011-07-14 11:01   ` J. Bakshi
  1 sibling, 1 reply; 7+ messages in thread
From: Jon Seymour @ 2011-07-14 10:53 UTC (permalink / raw)
  To: J. Bakshi; +Cc: git

On Thu, Jul 14, 2011 at 8:45 PM, J. Bakshi <joydeep@infoservices.in> wrote:
> Hello list,
>
> During git push or fetch over http , I need to provide username and password every time, as protected by apache htpasswd file. How can I provide the same along with git command ? Or something so that It save the authentication info somewhere within .git
>
> Thanks

You probably want to create the client setup section of this:

    http://kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt

Personally, I prefer to use an ssh hosted repository in such cases,
then use an ssh-agent to cache an SSH private key.

jon.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to provide authentication along with git command itself ?
  2011-07-14 10:50 ` Carlos Martín Nieto
@ 2011-07-14 10:59   ` J. Bakshi
  2011-07-14 11:12     ` Carlos Martín Nieto
  0 siblings, 1 reply; 7+ messages in thread
From: J. Bakshi @ 2011-07-14 10:59 UTC (permalink / raw)
  To: Carlos Martín Nieto; +Cc: git

On Thu, 14 Jul 2011 12:50:46 +0200
Carlos Martín Nieto <cmn@elego.de> wrote:

> On Thu, 2011-07-14 at 16:15 +0530, J. Bakshi wrote:
> > Hello list,
> > 
> > During git push or fetch over http , I need to provide username and
> > password every time, as protected by apache htpasswd file. How can I
> > provide the same along with git command ? Or something so that It save
> > the authentication info somewhere within .git 
> 
> The http transport uses the ~/.netrc file to get its authentication
> data.  `man netrc` will tell you about the syntax; for git, you need the
> 'machine', 'login' and 'password' fields.
> 
> Cheers,
>    cmn
> 
> 
> 

Thanks for the response. Can I use the same .netrc to store different authentication for different repo ? Is it somehow possible to store the information at the concerned .git of the repo ? I think this will be easier for multiple repos.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to provide authentication along with git command itself ?
  2011-07-14 10:53 ` Jon Seymour
@ 2011-07-14 11:01   ` J. Bakshi
  2011-07-14 20:02     ` Jonathan Nieder
  0 siblings, 1 reply; 7+ messages in thread
From: J. Bakshi @ 2011-07-14 11:01 UTC (permalink / raw)
  To: Jon Seymour; +Cc: git

On Thu, 14 Jul 2011 20:53:42 +1000
Jon Seymour <jon.seymour@gmail.com> wrote:

> On Thu, Jul 14, 2011 at 8:45 PM, J. Bakshi <joydeep@infoservices.in> wrote:
> > Hello list,
> >
> > During git push or fetch over http , I need to provide username and password every time, as protected by apache htpasswd file. How can I provide the same along with git command ? Or something so that It save the authentication info somewhere within .git
> >
> > Thanks
> 
> You probably want to create the client setup section of this:
> 
>     http://kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt
> 
> Personally, I prefer to use an ssh hosted repository in such cases,
> then use an ssh-agent to cache an SSH private key.
> 
> jon.

Well, I am using version 1.7, hence not DAV but using git-http-backend 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to provide authentication along with git command itself ?
  2011-07-14 10:59   ` J. Bakshi
@ 2011-07-14 11:12     ` Carlos Martín Nieto
  0 siblings, 0 replies; 7+ messages in thread
From: Carlos Martín Nieto @ 2011-07-14 11:12 UTC (permalink / raw)
  To: J. Bakshi; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

On Thu, 2011-07-14 at 16:29 +0530, J. Bakshi wrote:
[...]
> 
> Thanks for the response. Can I use the same .netrc to store different
> authentication for different repo ? Is it somehow possible to store
> the information at the concerned .git of the repo ? I think this will
> be easier for multiple repos.
> 

I'm not sure, but netrc is not specific for any particular protocol. It
assumes that your login and password are the same for several services
on the same computer or set of computers.

It's often less hassle (and more efficient wrt. data transfer) to use
SSH. With gitolite you can give people access to git repositories over
SSH without giving them SSH access to the machine proper.

Cheers,
   cmn

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to provide authentication along with git command itself ?
  2011-07-14 11:01   ` J. Bakshi
@ 2011-07-14 20:02     ` Jonathan Nieder
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Nieder @ 2011-07-14 20:02 UTC (permalink / raw)
  To: J. Bakshi; +Cc: Jon Seymour, git

J. Bakshi wrote:

> Well, I am using version 1.7, hence not DAV but using git-http-backend 

Ah, I forgot to mention the docs for gitolite and http-backend[1].

As for your original question about how to set up or cache credentials,
unfortunately I haven't tried it.  Based on git-push(1), it looks like
the usual

	http://username:pass@domain/path/to/repo

syntax should work if you're passing the full URL on the command line
or if it's okay to store the usernames and passwords in plaintext in
.git/config.

If that's not okay, it also might be possible to hack up something
evil with the GIT_ASKPASS variable.  Some of the patches mentioned in
the recent discussion about password prompts also might be
interesting[2].

Regards,
Jonathan

[1] http://sitaramc.github.com/gitolite/doc/http-backend.html
[2] http://thread.gmane.org/gmane.comp.version-control.git/176522

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-14 20:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-14 10:45 How to provide authentication along with git command itself ? J. Bakshi
2011-07-14 10:50 ` Carlos Martín Nieto
2011-07-14 10:59   ` J. Bakshi
2011-07-14 11:12     ` Carlos Martín Nieto
2011-07-14 10:53 ` Jon Seymour
2011-07-14 11:01   ` J. Bakshi
2011-07-14 20:02     ` Jonathan Nieder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).