# Git repo cannot be accessed. Please verify the repository exists

**URL:** https://discourse.roots.io/t/git-repo-cannot-be-accessed-please-verify-the-repository-exists/19290
**Category:** trellis
**Tags:** ansible, trellis
**Created:** 2020-10-09T07:18:59Z
**Posts:** 4

## Post 1 by @masoninthesis — 2020-10-09T07:18:59Z

I’ve been developing a project which requires me to spin up a lot of roots projects (Trellis/Bedrock/Sage) the past few months. I have a strict process I follow.

For the past few days I’ve been hitting a bug where my sites won’t deploy due to not connecting correctly to my github repo via SSH. The error I get:

```
TASK [deploy : Failed connection to remote repo] *******************************************************************************************************************************************************************************************
task path: /Users/masoninthesis/Sites/thefutur/trellis/roles/deploy/tasks/update.yml:27
System info:
  Ansible 2.9.9; Darwin
  Trellis version (per changelog): "Support Ansible 2.9"
---------------------------------------------------
Git repo git@github.com:masoninthesis/TheFuturLMS.git cannot be accessed.
Please verify the repository exists and you have SSH forwarding set up
correctly.
More info:
> https://roots.io/trellis/docs/deploys/#ssh-keys
> https://roots.io/trellis/docs/ssh-keys/#cloning-remote-repo-using-ssh-
agent-forwarding
fatal: [thefutur.jackalope.io]: FAILED! => {
    "changed": false
}
```

At first I thought maybe it was the capital letters I put in the github URL. So I fixed that to no avail.

I found a couple posts on this forum that seemed similar, so I followed all the steps suggested. Especially here by @fullyint–

> [@Can't deploy -](https://discourse.roots.io/t/cant-deploy/6433):
>
> I’ve been trying to deploy with Trellis. No errors when run: ansible-playbook -i hosts/production server.yml But when I try to deploy, I get this: TASK [deploy : Clone project files] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Failed to checkout master fatal: [mysite.com]: FAILED! =\> {"censored": "the output has been hidden due to the fact that 'no\_log: true' was specified for this result"} ...ignoring TASK [deploy : Failed connection to remote repo] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Git rep…

> Note that if you test ssh-agent forwarding by running

```
ssh web@example.com 'ssh -T git@github.com'
```

When I do this, I get: `Permission denied (publickey).`  
I configure `ForwardAgent yes` and `AllowAgentForwarding`, I still get permission denied.

**But I think that’s an unrelated issue.**

I found the issue for now. I’ll drop it in the next comment so I can mark it as the solution for now.

---

## Post 2 by @masoninthesis — 2020-10-09T07:25:57Z

I knew the issue might have something to do with my repo, or the URL. I recreated it multiple times. Changed the git url. Changed all letters to lower case. No luck.

I followed a step suggested from the other post above, I commented out [`no_log: true`](https://github.com/roots/trellis/blob/0667e4293d86b6920db838064433293be590a7d6/roles/deploy/tasks/update.yml#L31). This gave me an interesting error I hadn’t seen before:

```
"error: pathspec 'master' did not match any file(s) known to git."
```

Followed by the same error I logged above in the OG post. This made me take notice of the master branch. Maybe the branch had been changed somehow?

Then right as I was about to post this as a potential bug, I spotted something unusual in my repository.

On github’s website, my branch was called main branch. Main branch? Wtf? Shouldn’t it be master?

I created a new branch called master, re-deployed, and voila. It worked fine.

I used the Github Desktop app for Mac, mainly because as I’m training others, it’s way easier than having to teach them Git. I think github might have updated the app so that the master branch is called main by default. That seems like a bug to me, but maybe they’re changing things? Either way, I hope this might one day help some other poor soul like myself.

---

## Post 3 by @masoninthesis — 2020-10-09T08:22:02Z

GitHub changed the master branch to main on October 1st, 2020-

> **[github/renaming](https://github.com/github/renaming#new-repositories-use-main-as-default-branch-name)**
>
> Guidance for changing the default branch name for GitHub repositories - github/renaming

---

## Post 4 by @TangRufus — 2020-10-09T08:25:45Z

For those not using `master` as the default branch, change this line [https://github.com/roots/trellis/blob/a4cbce18b7b5902e033730eb33e732c76c595dd7/group\_vars/production/wordpress\_sites.yml#L14](https://github.com/roots/trellis/blob/a4cbce18b7b5902e033730eb33e732c76c595dd7/group_vars/production/wordpress_sites.yml#L14)

---

## Post 5 by @system — 2020-11-20T07:18:59Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
