I was using github.com as my iPhone development repositories. However, the github free version put all my codes to public and I am getting uncomfortable with it. At the same time, I don’t feel like spending monthly fee to subscribe to github’s private repository. After some digging, I found 1and1 hosting actually support git. Cool~! After some tries, I was able to make it work! Here is how:
- login to your 1and1 account by going to http://admin.1and1.com
- make sure you have “Git” under “Domains and Web Space” –> “Web Space”.
- Click on “Git” and then click on “SSH Access” button. You should setup a SSH account if you don’t have one yet, or write down your SSH username (ex. u22222) and make sure your password is correct.
- Now, open a terminal under OSX and ssh into your web site. Here is an example –> ssh -l u22222 www.vkick.com
- Once you are logged in, do the followings under 1and1
- create a .ssh folder if you don’t have one yet –> mkdir ~/.ssh (This is where we will copy your workstation public key to)
- create a folder to place all your git repositories –> mkdir ~/git-repo
- create a folder to place your project –> mkdir ~/git-repo/proj1
- initialize it for git –> cd ~/git-repo/proj1; git –bare init
- On your OSX workstation, open another terminal session to copy your public key to your 1and1 hosting. If you haven’t made your RSA public/private key yet, please follow the steps in my pervious blog: xcode 4.1 with github for Version Control and Co-Development under Prepare Your RSA Public/Private Key for Your Workstation section.
scp ~/.ssh/id_rsa.pub email@example.com:~/.ssh/authorized_keys
- now, go to where your saved your xcode project to setup git remote. Here is an example:
cd ~/Documents/XCODE-PROJ/proj1 git remote rm origin git init git remote add origin firstname.lastname@example.org:git-repo/proj git push origin master
“git remote rm” is to remove “origin” in case you perviously set it up with github. For “git remote”, u22222 is your 1and1 SSH username, then the 1and1 URL, and then the path where your plan to place your project.
That’s all. You should be able to do a PUSH in your xcode now.