pKaleta
pKaleta

Reputation: 63

Can I treat another git user as remote?

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?

Upvotes: 2

Views: 132

Answers (2)

Jaseem
Jaseem

Reputation: 2285

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.

Upvotes: 0

VonC
VonC

Reputation: 1323553

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.

Upvotes: 3

Related Questions