Skip to content

Instantly share code, notes, and snippets.

@onel0p3z
Forked from magnetikonline/README.md
Created June 3, 2013 14:55
Show Gist options
  • Save onel0p3z/5698762 to your computer and use it in GitHub Desktop.
Save onel0p3z/5698762 to your computer and use it in GitHub Desktop.

Creating a remote Git repository

  • Ensure you can ssh user@targetserver successfully
    • Public/private keys are a smart choice here
  • On targetserver
    • Example here assumes all Git repository users are members of a gitusers group, adjust to suit
    • mkdir -p ~/path/to/repository
    • cd ~/path/to/repository
    • git init --bare --shared=group
      • Switch --shared=group will add core.sharedrepository = 1 to the repositories ~/path/to/repository/config file
    • chgrp -R gitusers ~/path/to/repository
    • All done on targetserver
  • Now on development machine lets push working copy
    • mkdir -p ~/my/new/working/copy
    • cd ~/my/new/working/copy
    • git init
    • touch somefile.txt
    • git add .
    • git commit -m 'Initial commit'
    • git remote add origin user@targetserver:path/to/repository
    • git push -u origin master
    • git fetch
    • git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment