libgit2sharp repository credentials

2020-02-15 c# git libgit2sharp

I'm using LibGit2Sharp to clone a repository into a local folder. I know I could simply use Brute Force and delete the .git folder afterwards, and that will certainly achieve what I set out to achieve, but it's not the most elegant way to address this. If I deleted the .git folder I would have to clone it again at a later stage. I want to easily "switch" between branches but it becomes a slow and laborious process if every time I have to re-clone it before I can do that.

What I would like to do is to, after Cloning the repository, .... and here is where I don't know the correct terminology. what.... "log out"? "disconnect the credentials"? I don't know. Basically, what I want to achieve is that after the Clone a user cannot simply go and start messing about with the files and Push them back up to the remote repository, but I can't find any clear answers online about how to "clear credentials". I'm looking to do so programmatically, obviously.

Sorry. As this isn't clear in my own head I don't know how to ask this properly. I hope I described it clearly enough for someone to know how to answer this.

Answers in C# or VB.NET welcome ...