<?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 Charlesvandamme on Medium]]></title>
        <description><![CDATA[Stories by Charlesvandamme on Medium]]></description>
        <link>https://medium.com/@charlesvandamme2?source=rss-073814836cd7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0nRZgbgcuxOTZlrE</url>
            <title>Stories by Charlesvandamme on Medium</title>
            <link>https://medium.com/@charlesvandamme2?source=rss-073814836cd7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 04:28:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@charlesvandamme2/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[How to Access Private GitHub Repositories in OpenAI’s ChatGPT Using an OpenAPI Schema]]></title>
            <link>https://medium.com/@charlesvandamme2/how-to-access-private-github-repositories-in-openais-chatgpt-using-an-openapi-schema-688bb6d84cce?source=rss-073814836cd7------2</link>
            <guid isPermaLink="false">https://medium.com/p/688bb6d84cce</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[Charlesvandamme]]></dc:creator>
            <pubDate>Tue, 15 Oct 2024 22:54:20 GMT</pubDate>
            <atom:updated>2024-10-15T22:54:20.437Z</atom:updated>
            <content:encoded><![CDATA[<p><em>By Charles Van Damme</em></p><p>Integrating private GitHub repositories with OpenAI’s ChatGPT offers tremendous benefits for developers and teams working on collaborative coding projects. Whether you’re fetching code, performing analysis, or improving code quality, ChatGPT can now be linked to your private repositories securely and effectively using OpenAPI schemas. In this article, we’ll explore <strong>how to enable access to a private GitHub repository via OpenAI’s ChatGPT</strong> and highlight the benefits of this powerful integration.</p><h3>Why Integrate GitHub with ChatGPT?</h3><p>Imagine having a <strong>virtual assistant</strong> that can access your codebase, make suggestions, find errors, and help you improve your code across your entire project — all without leaving your repository. Integrating GitHub with ChatGPT brings significant benefits, such as:</p><ul><li><strong>Automated Code Review</strong>: Leverage ChatGPT to review pull requests or suggest improvements based on your repository’s content.</li><li><strong>Knowledge Retrieval</strong>: Quickly fetch files and directory structures from your repository for easy analysis and modification.</li><li><strong>Error Detection</strong>: ChatGPT can analyze your private code and help detect potential bugs or inefficiencies.</li><li><strong>Faster Development Cycles</strong>: By allowing ChatGPT access to your private repositories, you can automate routine tasks, improving productivity.</li></ul><h3>Step-by-Step Guide to Enable Access to a Private GitHub Repository</h3><h4>1. Generate a GitHub Personal Access Token (PAT)</h4><p>To allow ChatGPT to access a private repository, you’ll need to generate a <strong>GitHub Personal Access Token (PAT)</strong>. This token serves as the key that authenticates requests to your GitHub API.</p><p><strong>Steps to generate a PAT:</strong></p><ul><li>Navigate to <strong>GitHub &gt; Settings &gt; Developer Settings &gt; Personal Access Tokens</strong>.</li><li>Click on <strong>“Generate new token”</strong> and select the necessary scopes, particularly:</li><li><strong>repo</strong> (for full control over private repositories).</li><li>Copy the generated token, as you won’t be able to view it again.</li></ul><h4>2. Set Up Authentication in ChatGPT’s Configuration</h4><p>Once you have the PAT, configure it in ChatGPT’s API setup. The ChatGPT environment offers several authentication methods, but for accessing private GitHub repositories, you’ll use <strong>API Key</strong> authentication (also known as a Bearer Token).</p><p><strong>How to set it up:</strong></p><ul><li>In the ChatGPT configuration, select <strong>API Key</strong> as the authentication type.</li><li>Paste the Authentication token you copied from GitHub</li><li>Select <strong>Bearer </strong>as the authentication type</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*vSPAh3A110tSV7NInsNbKQ.png" /><figcaption>Screen grab of Auth configuration</figcaption></figure><p>This ensures that every request ChatGPT makes to the GitHub API will be authenticated using your token, allowing access to your private repositories.</p><h4>3. Modify the OpenAPI Schema</h4><p>Now, you need to define the structure of your OpenAPI schema to instruct ChatGPT on how to interact with the GitHub API. Here’s a sample OpenAPI schema to fetch the contents of a file or directory from your private GitHub repository:</p><pre>{<br>  &quot;openapi&quot;: &quot;3.1.0&quot;,<br>  &quot;info&quot;: {<br>    &quot;title&quot;: &quot;GitHub Code Access API&quot;,<br>    &quot;description&quot;: &quot;API for fetching code files from a GitHub repository to analyze using GPT.&quot;,<br>    &quot;version&quot;: &quot;v1.0.0&quot;<br>  },<br>  &quot;servers&quot;: [<br>    {<br>      &quot;url&quot;: &quot;https://api.github.com&quot;<br>    }<br>  ],<br>  &quot;paths&quot;: {<br>    &quot;/repos/{owner}/{repo}/contents/{path}&quot;: {<br>      &quot;get&quot;: {<br>        &quot;operationId&quot;: &quot;getGitHubRepoContent&quot;,<br>        &quot;summary&quot;: &quot;Fetch code files from GitHub&quot;,<br>        &quot;description&quot;: &quot;Retrieves the content of a specific directory or file from the GitHub repository.&quot;,<br>        &quot;parameters&quot;: [<br>          {<br>            &quot;name&quot;: &quot;owner&quot;,<br>            &quot;in&quot;: &quot;path&quot;,<br>            &quot;required&quot;: true,<br>            &quot;description&quot;: &quot;GitHub username or organization name&quot;,<br>            &quot;schema&quot;: {<br>              &quot;type&quot;: &quot;string&quot;<br>            }<br>          },<br>          {<br>            &quot;name&quot;: &quot;repo&quot;,<br>            &quot;in&quot;: &quot;path&quot;,<br>            &quot;required&quot;: true,<br>            &quot;description&quot;: &quot;Repository name&quot;,<br>            &quot;schema&quot;: {<br>              &quot;type&quot;: &quot;string&quot;<br>            }<br>          },<br>          {<br>            &quot;name&quot;: &quot;path&quot;,<br>            &quot;in&quot;: &quot;path&quot;,<br>            &quot;required&quot;: true,<br>            &quot;description&quot;: &quot;Path to the directory or file in the repository&quot;,<br>            &quot;schema&quot;: {<br>              &quot;type&quot;: &quot;string&quot;<br>            }<br>          }<br>        ],<br>        &quot;responses&quot;: {<br>          &quot;200&quot;: {<br>            &quot;description&quot;: &quot;Successfully retrieved the file or directory content.&quot;,<br>            &quot;content&quot;: {<br>              &quot;application/json&quot;: {<br>                &quot;schema&quot;: {<br>                  &quot;type&quot;: &quot;object&quot;,<br>                  &quot;properties&quot;: {<br>                    &quot;name&quot;: {<br>                      &quot;type&quot;: &quot;string&quot;,<br>                      &quot;description&quot;: &quot;The name of the file or directory&quot;<br>                    },<br>                    &quot;path&quot;: {<br>                      &quot;type&quot;: &quot;string&quot;,<br>                      &quot;description&quot;: &quot;The path to the file or directory&quot;<br>                    },<br>                    &quot;sha&quot;: {<br>                      &quot;type&quot;: &quot;string&quot;,<br>                      &quot;description&quot;: &quot;SHA identifier of the file version&quot;<br>                    },<br>                    &quot;content&quot;: {<br>                      &quot;type&quot;: &quot;string&quot;,<br>                      &quot;description&quot;: &quot;Base64-encoded content of the file&quot;<br>                    }<br>                  }<br>                }<br>              }<br>            }<br>          },<br>          &quot;404&quot;: {<br>            &quot;description&quot;: &quot;Directory or file not found.&quot;<br>          }<br>        }<br>      }<br>    }<br>  }<br>}</pre><p><strong>Explanation:</strong></p><ul><li>The schema specifies the API paths and methods for retrieving files or directories from a GitHub repository.</li><li>It uses placeholders like {owner}, {repo}, and {path} for dynamic values such as your GitHub username, the repository name, and the path to the file or directory.</li></ul><p><strong>Important Note</strong>: If you’ve already set the authentication type as an API key in the ChatGPT configuration, there is <strong>no need to include Bearer token authentication in the schema itself</strong>. The schema remains simple and focused only on defining API operations.</p><h4>4. Test the Configuration</h4><p>After setting up the API Key in the ChatGPT configuration and loading the schema, test the connection by attempting to fetch a file from your private repository. For example, I ask the custom gpt to describe a specific piece of code in my webshop repo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o0BrMK8eANMoCNcDfTbNkQ.png" /></figure><p>If everything is set up correctly, ChatGPT should be able to retrieve the file and provide analysis or suggestions based on its contents.</p><h3>Benefits of Enabling Access to Private GitHub Repositories in ChatGPT</h3><ol><li><strong>Increased Productivity</strong>: ChatGPT can assist with tasks like code reviews, bug fixing, and documentation of your private codebase, reducing manual effort and time. Note that you will still need to manually push the changes to git</li><li><strong>Automated Assistance</strong>: Whether you’re troubleshooting issues or improving code structure, ChatGPT offers automated support by analyzing the actual code within your repositories, without the need of re-uploading code changes in the GPT.</li><li><strong>Privacy and Security</strong>: By using <strong>Bearer token authentication</strong>, your repository remains secure, and access is controlled. The Personal Access Token can be revoked or regenerated at any time.</li><li><strong>Flexibility for Teams</strong>: Teams can integrate ChatGPT into their workflows, enabling seamless collaboration and feedback cycles. ChatGPT can assist in resolving coding challenges, answering technical questions, and improving development efficiency.</li></ol><h3>Conclusion</h3><p>By enabling access to private GitHub repositories, ChatGPT becomes an even more powerful tool in your development toolkit. It can analyze your code, assist with improvements, and ultimately help you ship better products faster. The process is secure and straightforward — simply configure your Personal Access Token, update your OpenAPI schema, and you’re ready to let ChatGPT work its magic on your private repositories.</p><p>As the development landscape evolves, integrating AI-driven tools like ChatGPT into your workflow is no longer optional — it’s becoming essential for staying competitive. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=688bb6d84cce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>