[ANN] Windows support for GitFileTree

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] Windows support for GitFileTree

Thierry Goubier
Hi all,

thanks to the help of Nicolai and Levente (and others), GitFileTree has
now working support for Windows users through ProcessWrapper (on the
development versions).

A way for it to work is to have git in your path and simply load:

Metacello new
        configuration: 'GitFileTree';
        version: #'development';
        repository: 'https://smalltalkhub.com/mc/Pharo/MetaRepoForPharo50/main';
        load

Expect this to move into stable GitFileTree if it is reported to work.

Next steps for gitfiletree are a metadata-less mode (for Alexandre :))
and svn support (aka SVNFileTree ;)).

Regards,

Thierry

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

abergel
:-)

Excellent!

Alexandre


> On Oct 9, 2015, at 6:35 PM, Thierry Goubier <[hidden email]> wrote:
>
> Hi all,
>
> thanks to the help of Nicolai and Levente (and others), GitFileTree has now working support for Windows users through ProcessWrapper (on the development versions).
>
> A way for it to work is to have git in your path and simply load:
>
> Metacello new
> configuration: 'GitFileTree';
> version: #'development';
> repository: 'https://smalltalkhub.com/mc/Pharo/MetaRepoForPharo50/main';
> load
>
> Expect this to move into stable GitFileTree if it is reported to work.
>
> Next steps for gitfiletree are a metadata-less mode (for Alexandre :)) and svn support (aka SVNFileTree ;)).
>
> Regards,
>
> Thierry
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

hernanmd
In reply to this post by Thierry Goubier
Hi Thierry,

Providing some feedback here.

I couldn't add a remote repository (image hangs) using Pharo 5. Working with GitHub Bash and SSH connections I think one needs to re-use ssh-agent environment variables before launching git commands. For example if ssh-agent.exe was sucessfully started and MSYS says:

$ env | grep ^SSH
SSH_AGENT_PID=5784
SSH_AUTH_SOCK=/tmp/ssh-Jpgwx10860/agent.10860

then from CMD.exe one could get both values using:

C:\> wmic process where ExecutablePath='c:\\Program Files (x86)\\Git\\bin\\ssh-agent.exe' get ProcessId

C:\> find /tmp/ssh-* -name agent.\* -uid $(id -u)|head -n 1

I have attached a change set with some refactorings and new methods to enable setting ssh-agent variables. It is not finished and it needs review. I do not have too much time but is a start, I hope.

Cheers,

Hernán






2015-10-09 18:35 GMT-03:00 Thierry Goubier <[hidden email]>:
Hi all,

thanks to the help of Nicolai and Levente (and others), GitFileTree has now working support for Windows users through ProcessWrapper (on the development versions).

A way for it to work is to have git in your path and simply load:

Metacello new
        configuration: 'GitFileTree';
        version: #'development';
        repository: 'https://smalltalkhub.com/mc/Pharo/MetaRepoForPharo50/main';
        load

Expect this to move into stable GitFileTree if it is reported to work.

Next steps for gitfiletree are a metadata-less mode (for Alexandre :)) and svn support (aka SVNFileTree ;)).

Regards,

Thierry



MCGitHubProcessWrapper.cs (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

Thierry Goubier
Hi Hernàn,

I'm not familiar with the use of ssh-agent. Could it interfere with
someone using his own keys (i.e. without ssh-agent)? Would this be
necessary for linux or mac use of ssh-agent, or is ssh / git correctly
done on those platforms to query ssh-agent on its own if it is already
running?

Anyway, I'll integrate that.

Thierry

Le 13/10/2015 06:19, Hernán Morales Durand a écrit :

> Hi Thierry,
>
> Providing some feedback here.
>
> I couldn't add a remote repository (image hangs) using Pharo 5. Working
> with GitHub Bash and SSH connections I think one needs to re-use
> ssh-agent environment variables before launching git commands. For
> example if ssh-agent.exe was sucessfully started and MSYS says:
>
> $ env | grep ^SSH
> SSH_AGENT_PID=5784
> SSH_AUTH_SOCK=/tmp/ssh-Jpgwx10860/agent.10860
>
> then from CMD.exe one could get both values using:
>
> C:\> wmic process where ExecutablePath='c:\\Program Files
> (x86)\\Git\\bin\\ssh-agent.exe' get ProcessId
>
> C:\> find /tmp/ssh-* -name agent.\* -uid $(id -u)|head -n 1
>
> I have attached a change set with some refactorings and new methods to
> enable setting ssh-agent variables. It is not finished and it needs
> review. I do not have too much time but is a start, I hope.
>
> Cheers,
>
> Hernán
>
>
>
>
>
>
> 2015-10-09 18:35 GMT-03:00 Thierry Goubier <[hidden email]
> <mailto:[hidden email]>>:
>
>     Hi all,
>
>     thanks to the help of Nicolai and Levente (and others), GitFileTree
>     has now working support for Windows users through ProcessWrapper (on
>     the development versions).
>
>     A way for it to work is to have git in your path and simply load:
>
>     Metacello new
>              configuration: 'GitFileTree';
>              version: #'development';
>              repository:
>     'https://smalltalkhub.com/mc/Pharo/MetaRepoForPharo50/main';
>              load
>
>     Expect this to move into stable GitFileTree if it is reported to work.
>
>     Next steps for gitfiletree are a metadata-less mode (for Alexandre
>     :)) and svn support (aka SVNFileTree ;)).
>
>     Regards,
>
>     Thierry
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

Peter Uhnak
On Tue, Oct 13, 2015 at 8:11 AM, Thierry Goubier <[hidden email]> wrote:
Hi Hernàn,

I'm not familiar with the use of ssh-agent. Could it interfere with someone using his own keys (i.e. without ssh-agent)? Would this be necessary for linux or mac use of ssh-agent, or is ssh / git correctly done on those platforms to query ssh-agent on its own if it is already running?

I'm using ssh-agent on both windows and linux, and having aforementioned variables (SSH_AGENT_PID, SSH_AUTH_SOCK) in the environment is enough for git to automatically use it, no need to prefix it.

In any case I have notes about the implementation:

1. it assumes that it runs only on windows (it looks like this should be generic code)
2. it assumes that ssh-agent will be always installed in a specific path, it should rely on PATH instead
3: Windows has its own system for global env variables, so why not use that? 
So instead of doing some process lookups you simply get $Env:SSH_AUTH_SOCK" (well, I use powershell... but the bat version is I think %SSH_AUTH_SOCK%)

Peter
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

Thierry Goubier


2015-10-13 9:29 GMT+02:00 Peter Uhnák <[hidden email]>:
On Tue, Oct 13, 2015 at 8:11 AM, Thierry Goubier <[hidden email]> wrote:
Hi Hernàn,

I'm not familiar with the use of ssh-agent. Could it interfere with someone using his own keys (i.e. without ssh-agent)? Would this be necessary for linux or mac use of ssh-agent, or is ssh / git correctly done on those platforms to query ssh-agent on its own if it is already running?

I'm using ssh-agent on both windows and linux, and having aforementioned variables (SSH_AGENT_PID, SSH_AUTH_SOCK) in the environment is enough for git to automatically use it, no need to prefix it.

This is what I expected. Is that different under Windows?


In any case I have notes about the implementation:

1. it assumes that it runs only on windows (it looks like this should be generic code)

Well, as you said above, the environment under Linux/Mac takes care of the interaction with ssh-agent... so there is no need to handle that on the Linux/Mac side (OSProcess) versus Windows (ProcessWrapper).
 
2. it assumes that ssh-agent will be always installed in a specific path, it should rely on PATH instead

Noted.
 
3: Windows has its own system for global env variables, so why not use that? 
So instead of doing some process lookups you simply get $Env:SSH_AUTH_SOCK" (well, I use powershell... but the bat version is I think %SSH_AUTH_SOCK%)

But the thing is: if I can query for environment variables in Windows, then so can the git command as well, which would mean it would pick-up the use of ssh-agent, no? Or should I try to manipulate the process 

Anyway, I appreciate you're having a look at it. Thanks!

Thierry
 

Peter

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

Robert Withers
Would the SSH package in Cryptography help you?

thanks,
Robert

On 10/13/2015 03:36 AM, Thierry Goubier wrote:

>
>
> 2015-10-13 9:29 GMT+02:00 Peter Uhnák <[hidden email]
> <mailto:[hidden email]>>:
>
>     On Tue, Oct 13, 2015 at 8:11 AM, Thierry Goubier
>     <[hidden email] <mailto:[hidden email]>> wrote:
>
>         Hi Hernàn,
>
>         I'm not familiar with the use of ssh-agent. Could it interfere
>         with someone using his own keys (i.e. without ssh-agent)? Would
>         this be necessary for linux or mac use of ssh-agent, or is ssh /
>         git correctly done on those platforms to query ssh-agent on its
>         own if it is already running?
>
>
>     I'm using ssh-agent on both windows and linux, and having
>     aforementioned variables (SSH_AGENT_PID, SSH_AUTH_SOCK) in the
>     environment is enough for git to automatically use it, no need to
>     prefix it.
>
>
> This is what I expected. Is that different under Windows?
>
>
>     In any case I have notes about the implementation:
>
>     1. it assumes that it runs only on windows (it looks like this
>     should be generic code)
>
>
> Well, as you said above, the environment under Linux/Mac takes care of
> the interaction with ssh-agent... so there is no need to handle that on
> the Linux/Mac side (OSProcess) versus Windows (ProcessWrapper).
>
>     2. it assumes that ssh-agent will be always installed in a specific
>     path, it should rely on PATH instead
>
>
> Noted.
>
>     3: Windows has its own system for global env variables, so why not
>     use that?
>     So instead of doing some process lookups you simply get
>     $Env:SSH_AUTH_SOCK" (well, I use powershell... but the bat version
>     is I think %SSH_AUTH_SOCK%)
>
>
> But the thing is: if I can query for environment variables in Windows,
> then so can the git command as well, which would mean it would pick-up
> the use of ssh-agent, no? Or should I try to manipulate the process
>
> Anyway, I appreciate you're having a look at it. Thanks!
>
> Thierry
>
>
>     Peter
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

Peter Uhnak
In reply to this post by Thierry Goubier


On Tue, Oct 13, 2015 at 9:36 AM, Thierry Goubier <[hidden email]> wrote:


2015-10-13 9:29 GMT+02:00 Peter Uhnák <[hidden email]>:
On Tue, Oct 13, 2015 at 8:11 AM, Thierry Goubier <[hidden email]> wrote:
Hi Hernàn,

I'm not familiar with the use of ssh-agent. Could it interfere with someone using his own keys (i.e. without ssh-agent)? Would this be necessary for linux or mac use of ssh-agent, or is ssh / git correctly done on those platforms to query ssh-agent on its own if it is already running?

I'm using ssh-agent on both windows and linux, and having aforementioned variables (SSH_AGENT_PID, SSH_AUTH_SOCK) in the environment is enough for git to automatically use it, no need to prefix it.

This is what I expected. Is that different under Windows?

this is the same under windows.
 
But the thing is: if I can query for environment variables in Windows, then so can the git command as well, which would mean it would pick-up the use of ssh-agent, no? Or should I try to manipulate the process 

Anyway, I appreciate you're having a look at it. Thanks!

I was setting up ssh-agent under windows couple years ago so I don't quite remember what was the problem exactly,
but iirc the problem was that ssh-agent was setting the variables only locally (maybe because it didn't understand windows env system).

So the way I forced it to work was that I manually created a permanent record for SSH_AUTH_SOCK with some predefined path,
and then I was starting the agent with "ssh-agent -a "$Env:SSH_AUTH_SOCK"

this way the agent was bound the the socket specified by the global variable.

Git itself was then able to correctly read the value from the environment, so I didn't have to change anything for git, it worked out of the box (as long as the env was correct).

Interestingly I never needed SSH_AGENT_PID, but maybe git just needs the socket.

Peter

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

Thierry Goubier
In reply to this post by Robert Withers


2015-10-13 9:46 GMT+02:00 Robert Withers <[hidden email]>:
Would the SSH package in Cryptography help you?

I don't know. I just delegate to git for handling the ssh stuff; Pharo has little to gain by manipulating ssh by itself in that use case (but, overalll, I believe ssh support to be usefull).

I'll have a look.

Thierry
 

thanks,
Robert

On 10/13/2015 03:36 AM, Thierry Goubier wrote:


2015-10-13 9:29 GMT+02:00 Peter Uhnák <[hidden email]
<mailto:[hidden email]>>:

    On Tue, Oct 13, 2015 at 8:11 AM, Thierry Goubier
    <[hidden email] <mailto:[hidden email]>> wrote:

        Hi Hernàn,

        I'm not familiar with the use of ssh-agent. Could it interfere
        with someone using his own keys (i.e. without ssh-agent)? Would
        this be necessary for linux or mac use of ssh-agent, or is ssh /
        git correctly done on those platforms to query ssh-agent on its
        own if it is already running?


    I'm using ssh-agent on both windows and linux, and having
    aforementioned variables (SSH_AGENT_PID, SSH_AUTH_SOCK) in the
    environment is enough for git to automatically use it, no need to
    prefix it.


This is what I expected. Is that different under Windows?


    In any case I have notes about the implementation:

    1. it assumes that it runs only on windows (it looks like this
    should be generic code)


Well, as you said above, the environment under Linux/Mac takes care of
the interaction with ssh-agent... so there is no need to handle that on
the Linux/Mac side (OSProcess) versus Windows (ProcessWrapper).

    2. it assumes that ssh-agent will be always installed in a specific
    path, it should rely on PATH instead


Noted.

    3: Windows has its own system for global env variables, so why not
    use that?
    So instead of doing some process lookups you simply get
    $Env:SSH_AUTH_SOCK" (well, I use powershell... but the bat version
    is I think %SSH_AUTH_SOCK%)


But the thing is: if I can query for environment variables in Windows,
then so can the git command as well, which would mean it would pick-up
the use of ssh-agent, no? Or should I try to manipulate the process

Anyway, I appreciate you're having a look at it. Thanks!

Thierry


    Peter




Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

Robert Withers
I just took a quick look. It depends on both LayeredProtocol and SSL,
but SSL won't load as HierarchicalUrl is missing.

thanks,
Robert

On 10/13/2015 04:02 AM, Thierry Goubier wrote:

>
>
> 2015-10-13 9:46 GMT+02:00 Robert Withers <[hidden email]
> <mailto:[hidden email]>>:
>
>     Would the SSH package in Cryptography help you?
>
>
> I don't know. I just delegate to git for handling the ssh stuff; Pharo
> has little to gain by manipulating ssh by itself in that use case (but,
> overalll, I believe ssh support to be usefull).
>
> I'll have a look.
>
> Thierry
>
>
>     thanks,
>     Robert
>
>     On 10/13/2015 03:36 AM, Thierry Goubier wrote:
>
>
>
>         2015-10-13 9:29 GMT+02:00 Peter Uhnák <[hidden email]
>         <mailto:[hidden email]>
>         <mailto:[hidden email] <mailto:[hidden email]>>>:
>
>              On Tue, Oct 13, 2015 at 8:11 AM, Thierry Goubier
>              <[hidden email]
>         <mailto:[hidden email]>
>         <mailto:[hidden email]
>         <mailto:[hidden email]>>> wrote:
>
>                  Hi Hernàn,
>
>                  I'm not familiar with the use of ssh-agent. Could it
>         interfere
>                  with someone using his own keys (i.e. without
>         ssh-agent)? Would
>                  this be necessary for linux or mac use of ssh-agent, or
>         is ssh /
>                  git correctly done on those platforms to query
>         ssh-agent on its
>                  own if it is already running?
>
>
>              I'm using ssh-agent on both windows and linux, and having
>              aforementioned variables (SSH_AGENT_PID, SSH_AUTH_SOCK) in the
>              environment is enough for git to automatically use it, no
>         need to
>              prefix it.
>
>
>         This is what I expected. Is that different under Windows?
>
>
>              In any case I have notes about the implementation:
>
>              1. it assumes that it runs only on windows (it looks like this
>              should be generic code)
>
>
>         Well, as you said above, the environment under Linux/Mac takes
>         care of
>         the interaction with ssh-agent... so there is no need to handle
>         that on
>         the Linux/Mac side (OSProcess) versus Windows (ProcessWrapper).
>
>              2. it assumes that ssh-agent will be always installed in a
>         specific
>              path, it should rely on PATH instead
>
>
>         Noted.
>
>              3: Windows has its own system for global env variables, so
>         why not
>              use that?
>              So instead of doing some process lookups you simply get
>              $Env:SSH_AUTH_SOCK" (well, I use powershell... but the bat
>         version
>              is I think %SSH_AUTH_SOCK%)
>
>
>         But the thing is: if I can query for environment variables in
>         Windows,
>         then so can the git command as well, which would mean it would
>         pick-up
>         the use of ssh-agent, no? Or should I try to manipulate the process
>
>         Anyway, I appreciate you're having a look at it. Thanks!
>
>         Thierry
>
>
>              Peter
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Windows support for GitFileTree

hernanmd
In reply to this post by Peter Uhnak


2015-10-13 4:29 GMT-03:00 Peter Uhnák <[hidden email]>:
On Tue, Oct 13, 2015 at 8:11 AM, Thierry Goubier <[hidden email]> wrote:
Hi Hernàn,

I'm not familiar with the use of ssh-agent. Could it interfere with someone using his own keys (i.e. without ssh-agent)? Would this be necessary for linux or mac use of ssh-agent, or is ssh / git correctly done on those platforms to query ssh-agent on its own if it is already running?

I'm using ssh-agent on both windows and linux, and having aforementioned variables (SSH_AGENT_PID, SSH_AUTH_SOCK) in the environment is enough for git to automatically use it, no need to prefix it.


I don't know if I get what you mean with prefix it. But the "set SSH_AGENT_PID=...." is done because the cmd.exe launched by ProcessWrapper does not detect SSH variables from other environment/term.

I think many platforms (MinGW/MSYS/Cygwin) use something like this to launch ssh-agent for every term:
echo "#!/bin/bash \
eval `ssh-agent -s` \
ssh-add" >> ~/.bashrc
 
In any case I have notes about the implementation:

1. it assumes that it runs only on windows (it looks like this should be generic code)
2. it assumes that ssh-agent will be always installed in a specific path, it should rely on PATH instead

Yes, some time ago I sent some FileSystem extensions to locate path binaries. I don't know if they are still around but it could be used.
 
3: Windows has its own system for global env variables, so why not use that? 
So instead of doing some process lookups you simply get $Env:SSH_AUTH_SOCK" (well, I use powershell... but the bat version is I think %SSH_AUTH_SOCK%)

I guess they could be used, but Git Bash is a MSYS command, so the environment variables need to be exported.

Hernán


Peter