<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Viktor István Plézer on Medium]]></title>
        <description><![CDATA[Stories by Viktor István Plézer on Medium]]></description>
        <link>https://medium.com/@viktorplezer?source=rss-58af8d989220------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*iju7raVFxPO-whWmOiY5ng.jpeg</url>
            <title>Stories by Viktor István Plézer on Medium</title>
            <link>https://medium.com/@viktorplezer?source=rss-58af8d989220------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 02 Jul 2026 09:23:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@viktorplezer/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Managing Git submodules with GitHub&Bitrise]]></title>
            <link>https://medium.com/@viktorplezer/managing-git-submodules-with-github-bitrise-2b67dfc82dfc?source=rss-58af8d989220------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b67dfc82dfc</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[bitrise]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[submodules]]></category>
            <dc:creator><![CDATA[Viktor István Plézer]]></dc:creator>
            <pubDate>Mon, 22 Jul 2019 13:41:30 GMT</pubDate>
            <atom:updated>2019-07-22T14:40:39.901Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*npJ9MNvLXh3lNEvxyq-Piw.jpeg" /></figure><h3>Motivation</h3><p>In my mobile dev team, we actively use Bitrise to automate the processes of nearly 80 apps. For version control, we’re using GitHub — a good pairing in most cases, but not without its hurdles (hence this post). To increase testability of our mobile apps, we wanted to create a crawler that extracts API responses from our test backend and stores them as JSON files, so that we can include these in our apps as mock data.</p><p>To achieve this, I started to develop a new app in Bitrise. Running this script saves 109 JSON files from 6 different endpoints into the directory called <strong>mocks. </strong>I want to automatically push the latest mock data files after each run to another Git repository so that our mobile apps can include them, so I’ve set up the <strong>mocks</strong> directory as a <strong>Git submodule</strong> in the crawler project.</p><p><strong>I’ve built my first Bitrise workflow for the crawler with the default Git clone configuration and failed miserably</strong> <strong>because of Git permission issues.</strong> Both Git repos should have the same SSH or deployment keys so we need some additional work here.</p><p>But… it turned out that <strong>GitHub does not support having the same SSH keys as deployment keys </strong>on multiple projects, therefore as the FAQ page suggests (<a href="https://devcenter.bitrise.io/faq/adding-projects-with-submodules/">read the details here</a>), I had to create a new bot/machine user on GitHub.</p><h3>How to set up submodule workflows with a machine user?</h3><h4>1. Register a new GitHub account</h4><p>I’ve registered ours with a Gmail address that we are also using as an Apple id and Google Play account. I’ve also saved all the credentials in 1password (choose your weapon), so if anything happens with me, my teammates will be able to continue the work. Let’s call our user <em>ci-user</em>.</p><p><strong>You have to add <em>ci-user</em> as a collaborator</strong> to all of the repositories you want to access. I am adding my user to 3 projects:</p><ul><li><em>_mobile_mock_crawler</em></li><li><em>_mobile_mock</em></li><li><em>_mobile</em></li></ul><h4>2. Generate an SSH key</h4><p>You also have to get an <strong>SSH key</strong> for <em>ci-user.</em><br>To generate it, open up your parent project’s Bitrise app and go to Settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pkqu8xuGE2pnGrH-6s5ENA.png" /></figure><p>Scroll down to the <strong>Change SSH keypair</strong> section and choose the <strong>Generate SSH keypair</strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iQnVvx-7WF4HDzD88a-5Fw.png" /></figure><p>Copy both the public and the private keys of your SSH key (also save it to 1password)!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gkVlGOMBYOiTvVB5Rykxdg.png" /><figcaption>Your public key</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBPGM69MPs9NHB6PVYCmBw.png" /></figure><p>Now head back to GitHub and add the public key in the Settings / SSH and GPG keys section (<a href="http://github.com/settings/keys">http://github.com/settings/keys</a>) for ci-user. Press the <strong>New SSH key</strong> button and paste your public key into the Key field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ks8ftb0Gw4m-YIdimqyWuQ.png" /><figcaption>Keys page of GitHub</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_f2La44LhvNXd4bifQ8rIw.png" /><figcaption>Paste your public key here</figcaption></figure><p>It’s alive! Bitrise can access your user and the Git permission issues are gone, the git-clone step succeeds. But as one of our projects is generating the other one, we can have additional steps.</p><h4>3. Pull submodules</h4><p>If you want to pull the freshest commits from your submodule, add a script step and pull it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SN-8babuF8MOpNFmsqpXvQ.png" /></figure><h4>4. Set up automatic Git push and pull requests</h4><p>Now let’s add the automatic push and pull-request recording to our workflow. To install our dependencies add a Brew install step and add hub as the name of the formula.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bk-4AhKvxzaMfpwMIu9jFw.png" /></figure><p>Add a script step and add these lines:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb7a818c57cb72402718e2d94c1a2bce/href">https://medium.com/media/bb7a818c57cb72402718e2d94c1a2bce/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dbiyDmacRRMG30g2LqMwuQ.png" /></figure><p><strong>Now every time I run our crawler project’s Bitrise workflow</strong></p><ul><li>it gets and pulls the submodule(s)</li><li>runs and generates the JSON files into the submodule</li><li>creates a branch and pushes the changes</li><li>records a pull request on GitHub</li></ul><p>Now the only thing I have to do is schedule this workflow or press the build button manually (and merging a PR) to have the freshest data JSON dump from our test backend in our mock data repo automatically.</p><h4>5. The Butterfly-effect</h4><p>Now we can add the mock data repo as a submodule to our mobile projects. <br>That’s bringing some additional steps for us, as we have to configure our mobile project’s Bitrise app to use the <em>ci-user</em>’s SSH key.</p><p>Open up the mobile project’s Bitrise app page and then the Settings page. Scroll down to the <strong>Change SSH keypair</strong> section and choose the <strong>Use your own SSH keypair</strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WzPhE9XWbHFytgBNDYaNzQ.png" /></figure><p><strong>The UI confusing a bit here, so pay attention now to copy the private(!) key of your SSH key even though the button says “I’ve added the Public key”!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Te7FLfB9W5OaB3J8zQc1lQ.png" /></figure><p>That’s it. With this technique, you can use the same SSH key for all of your GitHub projects.</p><h3>That worked so well that I’ve added the SSH key for all of our other projects as well, so we have a real CI bot/machine user now!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b67dfc82dfc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>