Search code examples
pythonvisual-studio-2010gitpython-2.7repository

How to use Google's repo tool on MS Windows OS?


I installed git for windows and it works fine(e.g. use one of the following solutions Want to download a Git repository, what do I need (windows machine)?).

I tried to use repo of google but it needs gpg and python 2.7. I installed both and it works fine the only problem is that repo script use some unix oriented features such as symbolic links and fcntl. Is there any alternative code of repo for windows?

I couldn't found some native solution by google. if there is one I'll try to push it into google repo git repository or try to use it as is.


Solution

  • Yes, Google repo script can be compliant with Windows. Follow the steps below.

    But before, as Borealid said repo as not been ported on Windows. repo (forall.py) uses fcntl that is not available on Windows (Unix only).

    However there is Cygwin and its own python and git tools.

    If git version from MSysGit project for you or if you love your git GUI that is based on MSysGit only, then follow the following steps. These steps ensure that Cygwin can create native NTFS symlinks. Else if the git from Cygwin is sufficient, you do not have to do it. But it is better as setting CYGWIN=winsymlinks:native tells Cygwin to use native NTFS symlinks instead of old Cygwin workaround.

    1. Use Windows Vista or later (or switch to Linux)
    2. Have Admin privileges
    3. Dowload and install Cygwin (32 or 64 bits)
    4. Select and install python and git (and gpg if you want) from Cygwin installer
    5. Set CYGWIN=winsymlinks:native in your Cygwin shell:

      export CYGWIN=winsymlinks:native
      mkdir NEW_DIR
      cd    NEW_DIR
      repo init -u YOUR_URL
      repo sync -j 7
      

    (see also my other post)