<p>I am new working with Airflow and Kubernetes. I am trying to use apache Airflow in Kubernetes.</p>
<p>To deploy it I used this chart: <a href="https://github.com/apache/airflow/tree/master/chart" rel="nofollow noreferrer">https://github.com/apache/airflow/tree/master/chart</a>.</p>
<p>I want to upload my dags in my github repository so:</p>
<pre class="lang-yml prettyprint-override"><code>gitSync:
    enabled: true
    # git repo clone url
    # ssh examples ssh://git@github.com/apache/airflow.git
    # git@github.com:apache/airflow.git
    # https example: https://github.com/apache/airflow.git
    repo: https://github.com/mygithubrepository.git
    branch: master
    rev: HEAD
    root: &quot;/git&quot;
    dest: &quot;repo&quot;
    depth: 1
    # the number of consecutive failures allowed before aborting
    maxFailures: 0
    # subpath within the repo where dags are located
    # should be &quot;&quot; if dags are at repo root
    subPath: &quot;&quot;
</code></pre>
<p>Then I see that to use a private github repository I have to create a secret as is specified in the value.yml file:</p>
<pre class="lang-yml prettyprint-override"><code># if your repo needs a user name password
    # you can load them to a k8s secret like the one below
    #   ---
    #   apiVersion: v1
    #   kind: Secret
    #   metadata:
    #     name: git-credentials
    #   data:
    #     GIT_SYNC_USERNAME: &lt;base64_encoded_git_username&gt;
    #     GIT_SYNC_PASSWORD: &lt;base64_encoded_git_password&gt;
    # and specify the name of the secret below
    #credentialsSecret: git-credentials
</code></pre>
<p>I am creating the secret:</p>
<pre class="lang-yml prettyprint-override"><code>apiVersion: v1
data:
  GIT_SYNC_USERNAME: bXluYW1l
  GIT_SYNC_PASSWORD: bXl0b2tlbg==
kind: Secret
metadata:
  name: git-credentials
  namespace: default
</code></pre>
<p>Then I use the secret name in the value.yml file:</p>
<pre class="lang-yml prettyprint-override"><code>repo: https://github.com/mygithubrepository.git
    branch: master
    rev: HEAD
    root: &quot;/git&quot;
    dest: &quot;repo&quot;
    depth: 1
    # the number of consecutive failures allowed before aborting
    maxFailures: 0
    # subpath within the repo where dags are located
    # should be &quot;&quot; if dags are at repo root
    subPath: &quot;&quot;
    # if your repo needs a user name password
    # you can load them to a k8s secret like the one below
    #   ---
    #   apiVersion: v1
    #   kind: Secret
    #   metadata:
    #     name: git-credentials
    #   data:
    #     GIT_SYNC_USERNAME: &lt;base64_encoded_git_username&gt;
    #     GIT_SYNC_PASSWORD: &lt;base64_encoded_git_password&gt;
    # and specify the name of the secret below
    credentialsSecret: git-credentials
</code></pre>
<p>but seems not bee working.</p>

<p>I see that you are connecting to your github repo via <code>https</code>.</p>
<p>Try to use:</p>
<pre><code>ssh://git@github.com/mygithubrepository.git
</code></pre>
<p>or simply</p>
<pre><code>git@github.com/mygithubrepository.git
</code></pre>
<p>You can experience issues with connecting via <code>https</code> especially if you have two-factor authentication enabled on your github account. It's described more in detail in <a href="https://medium.com/@ginnyfahs/github-error-authentication-failed-from-command-line-3a545bfd0ca8" rel="nofollow noreferrer">this</a> article.</p>
<p>Also take a look at <a href="https://stackoverflow.com/users/6309/vonc">VonC's</a> <a href="https://stackoverflow.com/a/29297250/11714114">answer</a> where he mentions:</p>
<blockquote>
<p>As noted in  <a href="https://stackoverflow.com/users/101662/oliver">Oliver</a>'s
<a href="https://stackoverflow.com/a/34919582/6309">answer</a>, an HTTPS URL
would not use username/password if  <a href="https://help.github.com/en/github/authenticating-to-github/securing-your-account-with-two-factor-authentication-2fa" rel="nofollow noreferrer">two-factor authentication
(2FA)</a>
is activated.</p>
<p>In that case, the password should be a  <a href="https://help.github.com/en/github/authenticating-to-github/accessing-github-using-two-factor-authentication#using-two-factor-authentication-with-the-command-line" rel="nofollow noreferrer">PAT (personal access
token)</a>  as seen in &quot;<a href="https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line#using-a-token-on-the-command-line" rel="nofollow noreferrer">Using a token on the command
line</a>&quot;.</p>
<p>That applies only for HTTPS URLS, SSH is not affected by this
limitation.</p>
</blockquote>
<p>As well as at <a href="https://stackoverflow.com/a/21027728/11714114">this one</a> provided by <a href="https://stackoverflow.com/users/3155236/rc0r">rc0r</a>.</p>
<p>But as I said, simply using <code>ssh</code> instead of <code>https</code> should resolve your problem easily.</p>
