Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to give a machine full access to a specific GitHub repository?

I created a repository under my GitHub. Some of the scripts need to be run on the computer in the university's computer lab where all the required software are installed. So I want to give that machine the full access to this repository so that I can easily pull and push from that machine to my remote repository.

The way to give full access to a machine I know so far is either by adding the machine's ssh key to my GitHub account or by generating a token from my GitHub account and using that token to clone (with HTTPS) the repository on that machine. But both ways will give the machine full access to all the repositories under my GitHub account. But I only want to give the machine the access to this specific repository not to the others.

How can this realized?

like image 292
Xiaokang Avatar asked Sep 11 '25 10:09

Xiaokang


1 Answers

The easiest way is to create an SSH deploy key. That key, which must be unique (that is, it must not be used for any personal account or as a deploy key elsewhere), can then read (and if you want, write) that repository and that repository only.

Generate an SSH key in the normal way (such as with ssh-keygen -t ed25519), then go to the main page of your repository → Settings → Deploy keys. Add the public (not private) portion there, and optionally give it write access.

like image 194
bk2204 Avatar answered Sep 14 '25 03:09

bk2204