Sites like Github and Bitbucket make it ridiculously easy to setup public and private remote repos, which might make a lot of sense for your team. Sometimes there is an added cost to this though, whether financially or simply introducing another third-party dependency into your project.
Setting up your own git repo is easy and allows you to host your versioning system on your own server.
We'll need to set up a dedicated user to manage the repos.
su - // Enter super user
adduser git // Create the new user with home directory
su git // Login as that user
cd ~/ && mkdir .ssh
cd .ssh
touch authorized_keys
ssh-copy-id is a handy package that allows you to copy your local machine's public key to the authorized_keys file on the remote machine.
I use the homebrew package manager on macOS which, if you don't, you can find more information on at http://brew.sh/
brew install ssh-copy-id
ssh-keygen -C "your@email.com" // Generate a new rsa key
ssh-copy-id <user@server> // Copies rsa keys to the authorized_keys file on the host
mkdir gitDirectory // Create folder for wherever you'll want the git repo
cd gitDirectory && git clone user@server:<repo.git>
git pull origin <branch> // or do an initial commit and push it up to the server
Other notes: To push a branch up to the server:
git checkout -b feature_branch_name
- ... edit files, add and commit ...
git push -u origin feature_branch_name