# Update remote module in ITK

**URL:** https://discourse.itk.org/t/update-remote-module-in-itk/2615
**Category:** Engineering
**Tags:** remotemodule
**Created:** [January 14, 2020, 10:55am UTC](https://discourse.itk.org/t/update-remote-module-in-itk/2615 "2020-01-14T10:55:22Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Gordian](https://discourse.itk.org/user_avatar/discourse.itk.org/gordian/32/335_2.png) [@Gordian](https://discourse.itk.org/u/Gordian)
#### Post date: [January 14, 2020, 10:55am UTC](https://discourse.itk.org/t/update-remote-module-in-itk/2615/1 "2020-01-14T10:55:22Z")

</div>

Hello,

just a question regarding the updates of remote modules in ITK.

I have a remote module in ITK. The \*.remote.cmake points to the \* github repo. Initially ITK load the files from the remote repo and build the remote module like the other modules.

If I change something inside the remote module (not using the ITK solution but another solution because I dont want to handle the large ITK solution) the changes are pushed on the remote github repo.  
**How do I update the remote module in ITK correctly?**  
**Does the ITK check if remote modules have changed?**

Currently I push my changes to the remote and change in to the local remote directory of ITK. From this directory I use git pull to update the code in this directory. Afterwards I build the remote module using the ITK solution.

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [January 14, 2020, 2:01pm UTC](https://discourse.itk.org/t/update-remote-module-in-itk/2615/2 "2020-01-14T14:01:37Z")

</div>

Each remote module has its own `*.remote.cmake` file, e.g. this one:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Remote/Thickness3D.remote.cmake>

  
The way to update a remote module in ITK is to update the hash in the corresponding file.

There is `REMOTE_GIT_TAG_Thickness3D` CMake variable in ITK’s configuration. This gets initialized at the time a remote module is enabled. If you delete it, it will be reinitialized again based on the hash in the file. The hash provided here overrides the one in the file - this is quite useful when making changes to the remote module.

There is also [UpdateRemoteModules.sh](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/Maintenance/UpdateRemoteModules.sh) which updates all the remote modules to the current version if they pass their tests. One of the maintainers runs this script every once in a while, to make sure we are using up-to-date versions of remote modules.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [January 14, 2020, 2:49pm UTC](https://discourse.itk.org/t/update-remote-module-in-itk/2615/3 "2020-01-14T14:49:47Z")

</div>

Another option, which work best when developing a module or making many changes, is to build the module externally.

For example, to build the `Thickness3D` module externally, first build ITK. In ITK’s build configuration _do not enable_ `Module_Thickness3D`.

```auto
git clone https://github.com/InsightSoftwareConsortium/ITK
mkdir ITK-build
cd ITK-build
cmake ../ITK
make

```

Then, build the module as a separate project against ITK:

```auto
git clone https://github.com/InsightSoftwareConsortium/ITKThickness3D/
mkdir ITKThickness3D-build
cd ITKThickness3D-build
cmake -DITK_DIR=${PWD}/../ITK-build ../ITKThickness3D
make

```

---

<div class="post-metadata">

### Author: ![Gordian](https://discourse.itk.org/user_avatar/discourse.itk.org/gordian/32/335_2.png) [@Gordian](https://discourse.itk.org/u/Gordian)
#### Post date: [January 14, 2020, 8:41pm UTC](https://discourse.itk.org/t/update-remote-module-in-itk/2615/4 "2020-01-14T20:41:55Z")

</div>

@dzenanz Thank you for the tip with [UpdateRemoteModules.sh](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/Maintenance/UpdateRemoteModules.sh) . I did not recognize the existence of this tool.

In my `*.remote.cmake` file the `GIT_TAG` is set to `master` therefore I guessed that it will update itself or do I still have to run UpdateRemoteModules.sh to replace the tag with the actual hash value?

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [January 14, 2020, 8:58pm UTC](https://discourse.itk.org/t/update-remote-module-in-itk/2615/5 "2020-01-14T20:58:26Z")

</div>

You don’t have to run `UpdateRemoteModules.sh`, but I guess you do need an occasional pull. I am not sure how frequently the pulls are done, and if they are even done by the ITK CMake code after the initial clone.

---

<div class="post-metadata">

### Author: ![melrobin](https://discourse.itk.org/user_avatar/discourse.itk.org/melrobin/32/277_2.png) [@melrobin](https://discourse.itk.org/u/melrobin)
#### Post date: [January 27, 2021, 11:09pm UTC](https://discourse.itk.org/t/update-remote-module-in-itk/2615/6 "2021-01-27T23:09:58Z")

</div>

I’m trying to incorporate some of the changes recently made to the remote module ITKRLEImage. How can I determine the current GIT\_TAG? I have run UpdateRemoteModules.sh and disabled and enabled the module in ccmake, but this was still not updated.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [January 28, 2021, 1:05am UTC](https://discourse.itk.org/t/update-remote-module-in-itk/2615/7 "2021-01-28T01:05:40Z")

</div>

@melrobin to use or make changes to a remote module, the best approach is to build it externally, as described above.

To check the version of a remote checked out with via ITK’s CMake configure, you can examine the Git repository at `ITK/Modules/Remote/<ModuleName>`, e.g.

```auto
cd ITK/Modules/Remote/RLEImage
git rev-parse HEAD

```
