# Cannot create git repo in GitHub

**URL:** <https://forum.ansible.com/t/cannot-create-git-repo-in-github/38181>\
**Category:** Ansible Project\
**Created:** [July 3, 2023, 3:39pm UTC](https://forum.ansible.com/t/cannot-create-git-repo-in-github/38181 "2023-07-03T15:39:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hieronymus](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/hieronymus/32/1624_2.png) [@hieronymus](https://forum.ansible.com/u/hieronymus)\
**Post date:** [July 3, 2023, 3:39pm UTC](https://forum.ansible.com/t/cannot-create-git-repo-in-github/38181/1 "2023-07-03T15:39:14Z")

</div>

Hi everyone,

I tried to create a git repository in GitHub with Ansible and I encounter two issues:

1. I did a lot of research and didn’t see much information about GitHub API Infrastructure.
2. I can get the information about a repo but I cannot create a new one. I’ve tried with github\_repo and uri Module without success:

With uri

- name: create repository  
uri:  
url: “[https://api.github.com/users/](https://api.github.com/users/)”  
method: POST  
body\_format: json  
headers:  
Accept: “application/vnd.github.v3+json”  
Authorization: “token {{ token\_perso }}”  
body:  
name: “{{ repository\_name }}”  
private: false  
auto\_init: true  
has\_issues: true  
has\_wiki: true  
has\_downloads: true  
register: response

With github\_repo

- name: create repository  
github\_repo:  
organization:   
access\_token: “{{ token\_perso }}”  
name: “{{ repository\_name }}”  
state: present  
register: response

Unfortunately I always received a Status code 404. I’ve configured my token with permission too.

“msg”: “Status code was 404 and not [200]: HTTP Error 404: Not Found”, “redirected”: false, “referrer\_policy”: “origin-when-cross-origin, strict-origin-when-cross-origin”, “server”: “[GitHub.com](http://GitHub.com)”, “status”: 404,

As anyone an idea?

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [July 3, 2023, 3:52pm UTC](https://forum.ansible.com/t/cannot-create-git-repo-in-github/38181/2 "2023-07-03T15:52:36Z")

</div>

Try removing the organization parameter from the github\_repo task.

---

<div class="post-metadata">

**Author:** ![hieronymus](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/hieronymus/32/1624_2.png) [@hieronymus](https://forum.ansible.com/u/hieronymus)\
**Post date:** [July 4, 2023, 6:41am UTC](https://forum.ansible.com/t/cannot-create-git-repo-in-github/38181/3 "2023-07-04T06:41:18Z")

</div>

Tried to remove the organization parameter but another error: SSL: CERTIFICATE\_VERIFY\_FAILED. To remedy this SSL problem (as test), I’ve deactivated the verification with http.sslverify=false but it doesn’t seem to work…

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [July 4, 2023, 8:10am UTC](https://forum.ansible.com/t/cannot-create-git-repo-in-github/38181/4 "2023-07-04T08:10:31Z")

</div>

That’s weird.  
Can you add -vvv and see what that says?

---

<div class="post-metadata">

**Author:** ![hieronymus](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/hieronymus/32/1624_2.png) [@hieronymus](https://forum.ansible.com/u/hieronymus)\
**Post date:** [July 4, 2023, 8:27am UTC](https://forum.ansible.com/t/cannot-create-git-repo-in-github/38181/5 "2023-07-04T08:27:19Z")

</div>

fatal: [localhost]: FAILED! =\> {

“changed”: false,

“invocation”: {

“module\_args”: {

“access\_token”: “VALUE\_SPECIFIED\_IN\_NO\_LOG\_PARAMETER”,

“api\_url”: [https://api.github.com](https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapi.github.com%2F&data=05%7C01%7Cjerome.meyer%40umb.ch%7C06c7c3373c6f4344cbeb08db7c6849d4%7Caa487a7d0a994ec89a842952762a0131%7C0%7C0%7C638240559592573728%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lH6pXaoJdWBhLn1%2B6z0B3MhqWFHRs4IdG%2BSfs%2BQJsYo%3D&reserved=0),

“description”: “”,

“force\_defaults”: true,

“name”: “testrepo”,

“organization”: null,

“password”: null,

“private”: false,

“state”: “present”,

“username”: null

}

},

“msg”: “Unexpected error. SSLError(MaxRetryError("HTTPSConnectionPool(host=‘[api.github.com](http://api.github.com)’, port=443): Max retries exceeded with url: /user (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE\_VERIFY\_FAILED] certificate verify failed (\_ssl.c:897)’),))",),)”

}

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [July 4, 2023, 9:54am UTC](https://forum.ansible.com/t/cannot-create-git-repo-in-github/38181/6 "2023-07-04T09:54:41Z")

</div>

Either your SSL and/or settings are off, or you’re behind some sort of evil man-in-the-middle proxy
