Skip to content

Instantly share code, notes, and snippets.

@brennovich
Created January 28, 2012 02:56
Show Gist options
  • Save brennovich/1692262 to your computer and use it in GitHub Desktop.
Save brennovich/1692262 to your computer and use it in GitHub Desktop.
Criar Remote git repo
#!/bin/bash
# Author: Brenno Costa
[email protected]
function echo_ssh_in_authorized_keys()
{
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'
}
# Setup git project bare
if [ $1 != -c ]; then
ssh $git_host 'mkdir -p ~/'$1'.git && cd ~/'$1'.git && git --bare init'
echo '# Add remote origin into your project folder:'
echo 'git remote add origin ssh://'$git_host'/~/git/'$1'.git'
elif [ $1 = -c ]; then
echo_ssh_in_authorized_keys
fi
if [ -n "$2" ]; then
echo_ssh_in_authorized_keys
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment