Last active
August 29, 2015 14:13
-
-
Save benjaminmullard/0cb2c593046295ff87c1 to your computer and use it in GitHub Desktop.
Migrate Git repository on Ubuntu 13.10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On Git host machine | |
sudo add-apt-repository ppa:git-core/ppa | |
sudo apt-get update | |
sudo apt-get install git | |
sudo useradd git -m -s /usr/bin/git-shell | |
cd ~git | |
sudo mkdir .ssh | |
sudo vi .ssh/authorized_keys | |
sudo chown -R git:git .ssh | |
sudo chmod 400 .ssh/authorized_keys | |
sudo chmod 700 .ssh | |
sudo mkdir <repo_name>.git | |
cd <repo_name>.git/ | |
sudo git init --bare | |
cd .. | |
sudo chown -R git:git <repo_name>.git | |
# On local machine | |
cd ~/<repo_name> | |
git remote add new_origin git@<git_host>:~/<repo_name>.git | |
git push new_origin master | |
git remote rename origin old_origin | |
git remote rename new_origin origin | |
# Generate SSH keys | |
mkdir ~/.ssh | |
chmod 700 ~/.ssh | |
ssh-keygen -t rsa -b 4096 | |
# Append content of ~/.ssh/id_rsa.pub to <remote maching>~git/.ssh/authorized_keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment