2

I want to push my commits to another git user (it is local development server that need t be a user not a git server) Is it possible to push to another git user? If yes then how?

pKaleta
  • 63
  • 1
  • 4
  • Do you mean that you want to push to a non-bare repo? How can you access it? – svick Nov 14 '11 at 00:12
  • I have 2 users (u1 and u2) with the same repo cloned (repo is on springloops). Can u1 push changes to u2 and u2 then to repo on springloops ? – pKaleta Nov 14 '11 at 00:16
  • Are both users on the same computer? If not, how can they access each other's repositories? – svick Nov 14 '11 at 00:18
  • THey are in the same local network. I thought it can be managed via "remote" (got this option in smartgit) – pKaleta Nov 14 '11 at 00:22
  • Please see this: http://nvie.com/posts/a-successful-git-branching-model/. It talks about what you are asking for. – yasouser Nov 14 '11 at 09:37

2 Answers2

3

If your user u1 can access the directory where u2's repo is, through a shared path, then:

    # u2
    cd /path/to/parent/directory/of/repou2
    git clone --bare repou2 barerepou2
    cd /repou2
    git remote add barerepo ../barerepou2
  • u1 can then add 'barerepou2' as a remote:
    git remote add repou2 /shared/path/to/u2/barerepo
  • u1 can now push to u2 repo:
    git push repou2 master
  • u2 can check from new contributions by u1
    git fetch barerepo

See "Git push only for bare repositories?" on the importance of pushing to a bare repo instead of directly repou2 repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Since you are trying to push to another user, its a push to a non bare repo, which is not preferred. You can do one of these to do the task.

  • Push to a server and let everybody pull from there, like github.com
  • Let the other guy pull from you. I would suggest this.

I hope this will solve the problem.

Jaseem
  • 2,236
  • 6
  • 28
  • 35