· 2 min read
Fixing Second Repo Permissions Issue in GitHub Codespaces
During a recent demo, I ran into a repository permissions issue in GitHub Codespaces after cloning another repo and trying to commit code—this didn’t work.

Introduction
On a recent demo, I had encountered a repository permissions issue when using GitHub Codespaces after cloning another repo within the same codespace and trying to commit code in the newly cloned repo - which didnt work and complained of a permissions issue.
This is a leasons learn’t post, occassionally things go wrong and want to show how to fix this either for my future self, or anyone encountering the same issue.
The demo, was to build a declarative agent in Agent Repo and submit to another repository as a Community Submission Repo like this:
Apparently, you cannot just clone the repo, and use the current token/credentials codespace is using. Even, applying repo permissions to the container did not resolve my issue.
The Answer
To resolve this:
- Create a personal token in GitHub
- Navigate to the repo hosting the codespace
- Use settings to create a new repository secret under Settings > Secrets and Variables > Codespaces secrets
- Re-clone the other (community) repository with
git clone https://USERNAME:$YOUR-SECRET-VARAIBLE-NAME@github.com/OWNER/REPO
- Repeat the exercise, e.g. copy the changes from one repo to another.
Conclusion
Occasionally things happen, so note to future self, please check permissions lol before a demo to 150+ people. Hope this helps folks too 😊
Resources
The following resource could be useful for you to learn further:
- Managing access to other repositories within your codespace | GitHub
- Troubleshooting authentication to a repository | GitHub
Enjoy!