I tried links in this article, seem doesn't work for me: https://stackoverflow.com/questions/31801271/what-are-the-supported-git-url-formats

Problem that I have setup a local git server at /srv/repo/ for example, and when I create a repo under it name test.git with --bare under username testuser, I'd like to add this test.git as remote from other local machine in the same network.

For example, local git server has ip address at, and I need to add its repo on machine that has ip address of for example.

If I use this URL and change user owner of test.git, I can do a push and pull, meaning it works as expected:

sudo chown -R git:testuser test.git/
sudo chown -R git:testuser test.git/*

But I created repo using another user called testuser, probably user and group owner of repo test.git belong to testuser, and push and pull will fail if I do NOT change the user owner of test.git to git: sudo chown -R git:testuser test.git/*

I'd like to add remote repo as: git:// that use testuser as user instead of git user because I create test.git under testuser.

  • Can you clarify one point here? The 'git@' URL would use the SSH protocol and the 'git://' URL would use the git protocol. Which of these protocols are you trying to work with? – Haxiel Oct 8 '18 at 5:54
  • I try to use ssh protocol, but what if I use git protocol in this case, how to achieve the same purpose? – Tuyen Pham Oct 8 '18 at 6:19

If you are using the SSH protocol to access the server-side repository, your read/write permissions are determined by the user/group/world permissions on the server. To set this permission on the repository, you can use the git init command with the --shared parameter when you create your repository. Setting --shared=true will set the repository to be writable at the group level. All users part of the same group can then write to the repository.

Your steps will then be something like:

mkdir test.git
git init --bare --shared=true test.git

When you use the git protocol, there's a daemon on the server that handles communication. In that case, the daemon and the repository can be owned by the same user.

You can find more details on setting up server-side git in the Git book.

  • Thanks, even though I can specify ssh protocol url with user: ssh://testuser@ – Tuyen Pham Oct 8 '18 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.