Re: [git-users] Cache credentials in my terminal session, not for a user account

2018-02-08 Thread Mark Waite
Thanks Tim for that introduction to using ssh-agent as a wrapper for a
shell command.  I had never seen that technique.  Very nice!

Mark Waite

On Thu, Feb 8, 2018 at 1:29 PM Timothy Rice 
wrote:

> Oops, sorry I didn't notice Mark's response before replying :D
>
> ~ Tim
>
>
> > If you clone over ssh (ssh://username@hostname/repopath or user@hostname
> :
> > repopath), then you can use a passphrase protected private key for that
> ssh
> > connection.  With a passphrase protected private key, only those who know
> > the passphrase can use it.  If you want to enter the passphrase only once
> > per session, you can use "ssh-agent" to remember the passphrase for the
> > duration of a session.
> >
> > $ eval $(ssh-agent)
> > $ ssh-add ~/.ssh/id_rsa
> > $ git clone username@hostname:repopath
> >
> > If you use http, you can refer to
> > https://help.github.com/articles/caching-your-github-password-in-git/
> for
> > hints on "credential helpers".
> >
> > Mark Waite
>
> --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Cache credentials in my terminal session, not for a user account

2018-02-08 Thread Timothy Rice
Oops, sorry I didn't notice Mark's response before replying :D

~ Tim


> If you clone over ssh (ssh://username@hostname/repopath or user@hostname:
> repopath), then you can use a passphrase protected private key for that ssh
> connection.  With a passphrase protected private key, only those who know
> the passphrase can use it.  If you want to enter the passphrase only once
> per session, you can use "ssh-agent" to remember the passphrase for the
> duration of a session.
> 
> $ eval $(ssh-agent)
> $ ssh-add ~/.ssh/id_rsa
> $ git clone username@hostname:repopath
> 
> If you use http, you can refer to
> https://help.github.com/articles/caching-your-github-password-in-git/ for
> hints on "credential helpers".
> 
> Mark Waite

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Cache credentials in my terminal session, not for a user account

2018-02-08 Thread Timothy Rice
Hi Maciej,

If I understand correctly what you are asking, I think you should be able
to use ssh-agent to store your personal ssh authentication in your own
shell, without that agent interfering with anyone else's.

A fact perhaps not widely known is that if you prefix any command with
`ssh-agent`, that command will be executed as a subprocess of the agent.
This agent will not be shared with anyone else, so you can use it as a
wrapper to Bash or Zsh. Thus you can store your own private authentication
even though you're in a shared account.

Example session:

  login $ ssh-agent /bin/bash
  ssh-agent $ ssh-add /path/to/your/own/ssh-key.pub
  ssh-agent $ cd /path/to/repo
  ssh-agent $ git push g...@github.com:/repo.git
  ssh-agent $ exit
  login $

You could also use, say, `screen` instead of `/bin/bash` to create a
session that persists between logins. However, this would allow anyone else
to appropriate your session for themselves using a `screen -dr ...`. Using
a one-off shell session is less convenient but more secure.


Kind regards,


Tim


On Thu, Feb 08, 2018 at 02:11:26AM -0800, Maciej Ł wrote:
> Hi! How can I cache GIT credentials in scope of a terminal session? My use 
> case is the following. Me and other developers share a single account on a 
> remote Linux machine. In a home directory we share a GIT project with 
> application-specific configuration files. Sometimes we need to pull/push 
> changes. I don't want to type my username and password every time. I also 
> don't want to cache my credentials in such a way that other developers 
> having simultaneous SSH sessions use my credentials to perform GIT 
> operations. How can I achieve this?
> 
> Maciej Ł.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Cache credentials in my terminal session, not for a user account

2018-02-08 Thread Mark Waite
On Thu, Feb 8, 2018 at 3:11 AM Maciej Ł  wrote:

> Hi! How can I cache GIT credentials in scope of a terminal session? My use
> case is the following. Me and other developers share a single account on a
> remote Linux machine. In a home directory we share a GIT project with
> application-specific configuration files. Sometimes we need to pull/push
> changes. I don't want to type my username and password every time. I also
> don't want to cache my credentials in such a way that other developers
> having simultaneous SSH sessions use my credentials to perform GIT
> operations. How can I achieve this?
>
>
If you clone over ssh (ssh://username@hostname/repopath or user@hostname:
repopath), then you can use a passphrase protected private key for that ssh
connection.  With a passphrase protected private key, only those who know
the passphrase can use it.  If you want to enter the passphrase only once
per session, you can use "ssh-agent" to remember the passphrase for the
duration of a session.

$ eval $(ssh-agent)
$ ssh-add ~/.ssh/id_rsa
$ git clone username@hostname:repopath

If you use http, you can refer to
https://help.github.com/articles/caching-your-github-password-in-git/ for
hints on "credential helpers".

Mark Waite

Maciej Ł.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Cache credentials in my terminal session, not for a user account

2018-02-08 Thread Maciej Ł
Hi! How can I cache GIT credentials in scope of a terminal session? My use 
case is the following. Me and other developers share a single account on a 
remote Linux machine. In a home directory we share a GIT project with 
application-specific configuration files. Sometimes we need to pull/push 
changes. I don't want to type my username and password every time. I also 
don't want to cache my credentials in such a way that other developers 
having simultaneous SSH sessions use my credentials to perform GIT 
operations. How can I achieve this?

Maciej Ł.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.