# github pat not working as credential

**URL:** <https://forum.ansible.com/t/github-pat-not-working-as-credential/37914>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 21, 2023, 9:05am UTC](https://forum.ansible.com/t/github-pat-not-working-as-credential/37914 "2023-04-21T09:05:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baziel\_de\_Leeuw](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Baziel\_de\_Leeuw](https://forum.ansible.com/u/Baziel_de_Leeuw)\
**Post date:** [April 21, 2023, 9:05am UTC](https://forum.ansible.com/t/github-pat-not-working-as-credential/37914/1 "2023-04-21T09:05:42Z")

</div>

Hi all,

AWX 22.0.0 external database that seems to be working ok, except it does not want to use my credentials in github.

I get

PLAY [Update source tree if necessary] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* TASK [Update project using git] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* fatal: [localhost]: FAILED! =\> {“changed”: false, “cmd”: “/usr/bin/git ls-remote ‘https://$encrypted$:$encrypted$@github.com/Baziel/maintenance.git’ -h refs/heads/HEAD”, “msg”: “fatal: unable to access ‘[https://github.com/Baziel/maintenance.git/](https://github.com/Baziel/maintenance.git/)’: Failed to connect to [github.com](http://github.com) port 443: No route to host”, “rc”: 128, “stderr”: “fatal: unable to access ‘[https://github.com/Baziel/maintenance.git/](https://github.com/Baziel/maintenance.git/)’: Failed to connect to [github.com](http://github.com) port 443: No route to host\n”, “stderr\_lines”: [“fatal: unable to access ‘[https://github.com/Baziel/maintenance.git/](https://github.com/Baziel/maintenance.git/)’: Failed to connect to [github.com](http://github.com) port 443: No route to host”], “stdout”: “”, “stdout\_lines”: } PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

however if I manually type this command from the command prompt it works fine (pat code changed to \*\*\* for obvious reasons:

[vagrant@server2 ~]$ /usr/bin/git ls-remote ‘[https://Baziel:ghp\_\*\*\*@github.com/Baziel/maintenance.git](https://Baziel:ghp_***@github.com/Baziel/maintenance.git)’ 4cd3dfd7a316be6923e557d95e73766b6bbc36a3 HEAD 4cd3dfd7a316be6923e557d95e73766b6bbc36a3 refs/heads/master [vagrant@server2 ~]$

Anybody any idea where I am going wrong?

credentials are added as follows, PAT as password as per instructions.

[![r/awx - github pat not working as credential](https://preview.redd.it/emj2rxx7vmta1.png?width=1565&format=png&auto=webp&v=enabled&s=c43f5c997e3ec17682372e7a449934349dad95e2)](https://preview.redd.it/emj2rxx7vmta1.png?width=1565&format=png&auto=webp&v=enabled&s=c43f5c997e3ec17682372e7a449934349dad95e2)

project is added like this:

[![r/awx - github pat not working as credential](https://preview.redd.it/2vke5g3gwmta1.png?width=1557&format=png&auto=webp&v=enabled&s=daa40aa00447f0ff864f5e100333f781fa17c33d)](https://preview.redd.it/2vke5g3gwmta1.png?width=1557&format=png&auto=webp&v=enabled&s=daa40aa00447f0ff864f5e100333f781fa17c33d)

Thanks,

Baziel

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [April 26, 2023, 6:43pm UTC](https://forum.ansible.com/t/github-pat-not-working-as-credential/37914/2 "2023-04-26T18:43:20Z")

</div>

github PATs are not to be used for project updates, use a source control credential instead where you can provide a username/password or ssh private key to access your private github repo [https://docs.ansible.com/automation-controller/latest/html/userguide/credentials.html#source-control](https://docs.ansible.com/automation-controller/latest/html/userguide/credentials.html#source-control)

AWX Team
