New Project links to previous incorrect Git repository

I’m not very conversant with GitHub, but when I tried to set up a new project in PIO, it seemed to automatically compare to a Git repository from a previous project. If I click on the bottom left hand corner on the name of the repository it brings up a list of other branches, from the previous project, but it doesn’t provide access to new repository (on same GitHub account) I can’t figure out how to connect to new repository within PIO. Any idea what I am doing wrong?

PIO is not responsible for the Git part, that’s a separate part of VSCode. Also it should not auto-link your project to a github repository. The only way this would happen is if you created a project in a folder that was already a git repository.

I’d suggest to open a CLI and check the basics first. Is the project folder really a git repository? Check that with git status. If it says fatal: not a git repository, it’s not. You can then initialize and setup the remote as per Github docs. If it is but it shouldn’t be, remove the hidden .git folder to not make it a git repo anymore.

1 Like

Thank you Max for taking the time to educate on this topic. I now realize that this is a PIO topic, but I appreciate your support.
It seems that I have a folder called projects, within which I have several projects. The .git folder is in the root projects folder and so when I created a new folder (Germination) in the projects folder, it took on the attributes of the .git folder.

It’s not clear to me why previously each project in this folder had its own git repository, yet this Germination project which I created, seemed to pull in all files within the higher level folder.

You can see here that VS has tracked all the files, instead of just the files in my new project.

If I delete the .Git folder, I assume it will affect all projects in this directory, which is not desirable.

I am trying to set up a project with several ESP’s and I am confused how I can do this in PIO within one project, when I assume I can only have 1 main.cpp per project. Is there a way to manage this?

Many thanks,

Paul

You should check whether you actually want to have the root Projects folder be a git repository. If you open a CLI and navigate to its path using cd <path> (or, if the CLI drops you into a specific project, cd .. to go one folder above will also get you there), use the command git remote -v to see what remote endpoint URL it points to. You can also execute git log -4 to see that last 4 commit messages of that repository.