Mar 2, 2018 6:15:41 PM seb leridon avatar   1123

Synchronization of GitHub repositories

A lutece.sh shell script is available to make it easier to synchronize GITHub GIT repositories to the desktop. The synchronization command is:

lutece.sh sync

The script will drop all new lutece-platform and lutece-public-sector repositories and synchronize existing repositories.

Prerequisites

Linux

You must have the following applications:

  • cURL
  • git
  • lutece.sh script

Windows

You must have the following applications:

  • git bash
  • lutece.sh script

Installation

Debian / Ubuntu

You can install the necessary software with the following command in root:

root apt-get install curl git

Centos / Fedora / Red Hat

You can install the necessary software with the following command in root:

root # yum install curl git

or with dnf:

root # dnf install curl git

Windows

The software "Git for Windows" brings a graphical interface for GIT as well as Git Bash. You can download the latest version on this one: https://git-for-windows.github.io/

It is important to check the box to launch .sh scripts with bash git.

Get lutece.sh

You must download lutece.sh on github at the following address: https://raw.githubusercontent.com/lutece-platform/tools-git-scripts/master/lutece.sh

Linux

You can type these commands to use the script:

$ wget "https://raw.githubusercontent.com/lutece-platform/tools-git-scripts/master/lutece.sh" -O "$ {HOME} /lutece.sh"
$ chmod + x "$ {HOME} /lutece.sh"

Proxy or proxy

To configure a proxy server on linux or on windows (git bash), you can add these lines to the .bashrc file located in your $ HOME folder:

export HTTP_PROXY = "http: // user: password@mon.proxy: 3128 /"
export HTTPS = PROXY = "$ HTTP_PROXY"
export http_proxy = "$ HTTP_PROXY"
export https_proxy = "$ HTTP_PROXY"

Little explanation:

  • http: - the protocol to use by your proxy server,
  • user - the login to authenticate to the proxy server (optional),
  • password - the password linked to your login (optional),
  • my.proxy - the IP address or host of the proxy server,
  • 3128 - the port on which your proxy server is waiting for requests

Linux

Under linux, there is already the .bashrc script in your home (vi ~ / .bashrc), so add these lines at the end of the file.

Windows

It may be necessary to create an environment variable for the HOME under git bash, for this it is necessary:

  • press the "windows" + "pause" keys,
  • in the window that opens, select "advanced settings",
  • click on the "environment variables" button,
  • finally add the variable HOME (in capitals) and in value you can put, for example, C: \ Users \ User \.

For curl to work properly, it is also necessary (if you use mintty, the console with colors and resizable, unlike the normal console of windows) with the current version of git for windows (2017-06-07) to revive a shell with console support for native windows programs:

$ winpty bash

Use the script

In a terminal, you can synchronize github repositories with the command: lutece.sh sync

Advanced use

The lutece.sh script can take different parameters depending on what you want to do. It is possible to know all the parameters by launching the script without parameters: lutece.sh

Here are some examples of uses:

  • using an SSH key: lutece.sh sync -t ssh
  • without questioning: lutece.sh sync -u "Jean Martin" -e jean.martin@example.com
  • specifying a specific synchronization path: lutece.sh sync path / to_my_folder_lutece / git
  • with an SSH key, without questioning in a specific directory: lutece.sh sync -t ssh -e jean.martin@example.com -u "Jean Martin" lutece / git
  • modify my email (for commit): lutece.sh config -e martin.jean@example.com

Act

Linux

You can create an alias to launch your order faster. Suppose your order is:

lutece.sh -t ssh sync lutece / git

You must add to the .bashrc file, this line:

alias lutece = "$ {HOME} /lutece.sh sync -t ssh lutece / git"

Then restart the terminal or type the command: source ~ / .bashrc

Windows

You can create a shortcut on the desktop that will launch your order. Suppose the lutece.sh script is in: C: \ Users \ Me \ lutece.sh [quot ;.

  • Create a shortcut lutece.sh on the desktop (right click on the desktop: " new " = > [[short;
  • name it as you want
  • in the " command line " write : [Quot; C: \ Users \ Me \ lutece.sh " [Quot; C: \ Users \ Me \ Projects \ lutece \ git " You just have to double-click to update your repositories.