hello! For University I need to use a remote machine with a very very VERY weak password I cannot change, and I have to use that machine to edit some code with a few other students of my team. All the code should then be pushed to a repo of my personal github. I’d like to be able to grant access to only that repo, so that if someone guesses the password it cannot touch my other stuffs. What options do I have?
[SOLVED] EDIT:
as suggested by @[email protected] I created a github fine grained access token setting its only permission as read/write only that repo. Then I cloned the repo on the remote machine and set the url to include the token:
git remote set-url origin https://myusername:[email protected]/myusername/myrepo.git
I then set the user and email:
git config user.name myusername
git config user.email [email protected]
and voilà! I can now simply push without any password requested! And in case someone gained access to the token (that is stored in plain text inside the .git folder) it would only grant access to that specific repo, limiting the damages
Take a look at fine grained personal access tokens on GitHub, and this SO thread that discusses using them over HTTPS. In theory this should allow you to make a token that can only access the one remote repository, for a temporary duration you define (you could set this to end shortly after your semester for instance). I’ve never personally set this up so YMMV, but this seems to be the right way to achieve what you want.
It worked great! exactly what I was looking for, thank you very much!
Glad to hear, good luck with your project.
Seems really promising! I’ll try and let you know if it worked as I wish it will! Thanks!