Private Git Repositories
Jump to navigation
Jump to search
Private Git repos
Sometimes you'll want to have your own Private git repo and if you're like me you have your own resources to do so, a simple way to get setup for your own Private repo (not shared!) is as follows:
Since i doubt you are using passwords for ssh i'll assume you've already setup your RSA key with pass-phrase:
On the server
mkdir .git-repos mkdir .git-repos/some-reponame.git (or just mkdir -p .git-repos/some-reponame.git for short) cd .git-repos/some-reponame.git/ && git init --bare
a nice tidy place to put them..
On your local machine.. in your favorite work folder with all your work in it:
git init git add . git remote add origin username@xinchejian.com:.git-repos/some-reponame.git git commit -am "first commit.. woo hoo. xcj" git push origin master
Now if you want auto-checkout to say.. a web directory.. do this on the server:
(ee|vi|vim|nano) ~/.git-repos/some-reponame.git/hooks/post-receive
#!/bin/sh GIT_WORK_TREE=/path/to/your/httpdocs/folder git checkout -f
chmod +x ~/.git-repos/some-reponame.git/hooks/post-receive
If you get permission errors, then modify as needed