Home > other >  Can different sessions of the same linux user have different local repos for the same public repo?
Can different sessions of the same linux user have different local repos for the same public repo?

Time:03-09

We have a program with only one license on a linux machine, so we have to work with different sessions of the same user. Is it still possible to have 2 working local repositories on that machine that push and pull to/from the same public repo?

Could there be any workaround to make that work?

CodePudding user response:

Everything about a git repository in Linux is stored remotely in the repository's directory, inside the hidden directory .git

This means you can have two directories that are repositories with their own history that can push/pull/fetch/etc without affecting the other one.

Let's say you have a public GitHub repository. You could create two directories:

mkdir workingDirOne

mkdir workingDirTwo

Then, clone the public repository into each one

cd workingDirOne

git clone (GitHub URL)

cd ..

cd workingDirTwo

git clone (GitHub URL)

In this case, both workingDirOne and workingDirTwo will have their own versions of the repository. Now two instances of the same user could modify one without affecting the other.

  • Related