GIT SSH REPO
This is the quick and dirty guide to setting up your own git repo via SSH.
SERVER
mkdir /path/repo.git
git init --bare /path/repo.git
CLIENT
cd /path/to/project
git init
git add .
git commit -m "Initial commit"
git remote add origin ssh://user@host:/path/repo.git
git push --set-upstream origin master
TIPS
- Passwordless SSH logins are quite handy.
-
This is not a fileserver, so you can't "see" the files. This would be a bad thing if you could and modify them, as git would not have any accountability for the changes, and likely would be reverted to pre-change plus other changes done by someone. Here is a good writeup on bare/working repos:
Well, a working repository created with git init is for… working. It is where you will actually edit, add and delete files and git commit to save your changes. If you are starting a project in a folder on your dev machine where you will add, edit and delete files of your project, use “git init”. Note: if you git clone a repository you will be given a working repository with the .git folder and copies of the working files for editing. A bare repository created with git init --bare is for… sharing. If you are collaborating with a team of developers, and need a place to share changes to a repo, then you will want to create a bare repository in centralized place where all users can push their changes (often the easy choice is github.com). Because git is a distributed version control system, no one will directly edit files in the shared centralized repository. Instead developers will clone the shared bare repo, make changes locally in their working copies of the repo, then push back to the shared bare repo to make their changes available to other users. Because no one ever makes edits directly to files in the shared bare repo, a working tree is not needed. In fact the working tree would just get in way and cause conflicts as users push code to the repository. This is why bare repositories exist and have no working tree.
-
To avoid usage of ssh, you can opt to use something like GitLab, which is for more complex setups, or very simple ones. It has user/group management, privacy tools, and a full webui to maniplulate things.