I have a server where multiple users connect through RDP and work with Visual Studio. Now there is a project which they will have to work at the same time, and want to start implementing local control version.
I have created a repo from a project, opened it with two users and made some tests, but when saving (Ctrl + S) some change, it instantly overwrites the other user (They are both working over the same files).
These are the steps I followed:
-
Create a project on VS. It’s saved on X:ProjectsTests ; checked the save solution and project on the same directory.
-
Go to the GIT menu, create GIT Repo local, path X:ProjectsTestsGitTests > Create
If I try to open the repo folder, I only get the .gitignore and .gitattributes in the solution explorer.
Is this the expected behaviour, or have I messed up during the set up? How should I configure it then? All guides I’ve found connect to GitHub which I would rather not.
Thanks for your help
If you don’t want to use GitHub then the best way to work collaboratively in RDP environment is to create different folders for each users and let the main/master folder be there which will be taken care by admin. This way security will also be there as the main branch folder can be protected.
You can achieve this simply by following these steps:
- Create the local git repository in Main folder i.e. X:ProjectsMain by using
git init
git checkout main
git add.
git commit -m "message"
- Create the clone for each user eg. user One, you can create a new folder X:ProjectsOne and clone over there by using command
git clone X:ProjectsMain
and then create a new branchgit checkout branch-one
and commit those changes and add the remote of cloned repository to the main repositorygit remote add cloned_repo_one X:ProjectsOne
- The admin of the project then can merge in the main folder by first fetching the branch
git fetch cloned_repo_one
git merge new-branch-name
This is an ideal way of working collaboratively on a local repository, if there is any better solution then I’ll be happy to discuss it.
Assuming that X:
is a shared drive, you only want to create the git
repository there, and each user should create their own source code tree under C:Projects
or the like.
Actually, ideally X:
should be a remote repository and each user should clone it into their local C:Projects
folder. VS Code, at least, has the Source Control tab, which on an empty project has the option Clone Repository, which will create a local copy of the repository on the X:
drive.