Can multiple users share a git clone directory?

Asked 2 years ago, Updated 2 years ago, 48 views

A user A is publishing the directory git clone to the server.
The repository is in Gitorganization.
Is it possible for user B to update the directory on the server with git pull in Organization?

$sudogit pull
remote —Support for password authentication was removed on August 13, 2021. Please use a personal access token installed.
remote —Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/for more information.
fatal —Authentication failed for 'https://github.com/user_a/stackoverflow.git/'

appears.
The error is that the password has been deprecated...
authentication failed for 'https://github.com/user_a/stackoverflow.git/'
I noticed that it was user_a in .

git

2022-09-30 19:26

2 Answers

If you want to edit the local repository as a shared directory directly by multiple users, it is safe to avoid it as there may be inconsistencies.

Bare and non-bare repositories:theoretical edition

Git doesn't have a file lock, so if multiple people commit to a non-bare repository with real files, inconsistencies will occur.

Since it has already been shared using a remote repository, I think the original way to use it is to work with a local repository managed by each user.


2022-09-30 19:26

(As someone else wrote, I felt it was impossible to understand the intentions from the current questionnaire, but as one of the possibilities)
I understand that user B wants to reflect updated.git repository updates to the original.git repository in the situation shown below.

Place of Placement
(plantuml)

First, clone the original.git (named origin) that user B has administrative rights to locally:

 git clone [email protected]:organization_x/original.git
cd forked

Then add the repository updated.git you want to import under the name user_a:

 git remote add user_a [email protected]: user_a/updated.git

Get the latest information for user_a:

git fetch user_a
# Or git fetch --all gets all repository information

The git branch-r command displays the branch name that contains the user_a repository, so you should then operate it the same way you handle a single remote repository.
For example, if you want to merge the master branch of user_a:

The branch name #user_a/master can be found in the git branch-r command.
git merge user_a/master

The key point here is that the git remote command handles multiple remote repositories, so searching the web with the phrase "git remote add" may help you understand better.

For example, in the GitHub documentation, there's an explanation (unfortunately, it's not very easy to understand, so it's better to hit the others).is):


2022-09-30 19:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.