Skip to content

Instantly share code, notes, and snippets.

@Susensio
Last active January 11, 2019 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Susensio/8d2fc2981048c12d828d7c7c789c7e38 to your computer and use it in GitHub Desktop.
Save Susensio/8d2fc2981048c12d828d7c7c789c7e38 to your computer and use it in GitHub Desktop.
First git push to remote

Disclaimer

This gist allows full control from the client, discarding all possible changes made in the server!

NOT USEFULL for colaborative work without further modifications. Coworkers commits could be deleted.


Server

Init server repository and configure

mkdir <path>
cd <path>
git init

Add to .git/config

[receive]
  denyCurrentBranch

Create hook post-receive

#!/bin/sh
GIT_WORK_TREE=<path> git checkout -f

Client

Add remote on client

git remote add <name> <user>@<server>:<path>
git push --set-upstream <name> <branch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment