:e ~/article/git-ad-hoc-sharing-of-repository.md [readonly]

smjrifle@smjrifle.xyz:~/article/ $

Git ad-hoc sharing of repository

Sometimes you need to quickly share a git repository with a colleague on the same network without setting up a full server.

On the host machine, edit your gitconfig:

# ================================
# On Computer A (host machine)
# ================================

# Open your Git config file
vi ~/.gitconfig

# Add this alias
[alias]
    serve = !git daemon --reuseaddr --verbose --base-path=. --export-all --enable=receive-pack ./.git

# Save and exit


# ================================
# Get your IP address
# ================================

ifconfig

# Note the IP address of Computer A


# ================================
# Allow pushing to current branch
# ================================

git config receive.denyCurrentBranch ignore


# ================================
# Start the Git server
# ================================

git serve


# ================================
# On Computer B (client machine)
# ================================

git clone git://YOUR_IP_ADDRESS/ directory_to_add_repo_to

# Now you can:
# - edit files
# - add changes
# - commit
# - pull
# - push


# ================================
# After pushing changes
# ================================

# Stop the server on Computer A
# Press Ctrl + C

# Reset repo to reflect new changes
git reset --hard


# ================================
# Note
# ================================

# --hard will reset both the index and working tree.
# Any uncommitted changes will be permanently lost.

This creates a quick ad-hoc git server on your LAN.

[:bp] Fedora fix Multilib version problems [:bn] Installing Git on your server
-- NORMAL -- git-ad-hoc-sharing-of-repository.md PHP UTF-8 0% smjrifle@xyz