Posts Tagged 'Git'

How to use git over scp without git on the remote server

This is basically a quick adaptation of this handy tutorial to use scp instead of a usb drive. I find it useful when I have a project I want to track using git across multiple computers, and I don’t want to make it public and use github.

First, make a new directory someplace that will be your local “remote” repository. Essentially, we will use this as the remote repository and use scp to update it when necessary, and then pull from and push to it. Then cd to your working directory, and do

git clone –local –bare . /path/to/remote/repository.git

Then, add it as a remote

git remote add origin file:///path/to/remote/repository.git

Once you’ve done this, you can simply do a git push to push to this repository. Now, when you want to use this repository on another computer, first copy it to a remote server using scp:

scp –r /path/to/remote/repository.git user@host:~/git/repository.git

I like to make a git directory in my home directory both locally and on the server, to store my “remote” repositories. Whenever you update the local “remote” git repository, just use scp to copy it to the server.

When you want to get at this repository from another computer, use scp to pull down the repository, and then do a git clone or git pull to get your updated contents into your working directory.

scp –r user@host:~/git/repository.git /path/to/different/remote/repository.git

and then a git clone or git pull as necessary.
Hope this helps someone, as I was looking for something like this and couldn’t figure it out initially. It’s pretty simple but for a git newbie like me it wasn’t immediately obvious.

Advertisements

Github

I’ve been using SVN for several years now, because revision control is essential to programming pretty much anything slightly complicated. SVN is really straightforward and easy to use, and it has served me well. However, these days people are moving on to distributed version control systems, so I figured I’d check one out (pardon the pun). These days, the most popular thing in the open source world seems to be git, so I decided on that. The learning curve is decidedly sharper than SVN’s, but I’m sort of finding my way through it. The thing I really like about git is github; sort of a social network for git code hosting. I’ve got an account there and I’ll be pushing my random test stuff onto that for the time being. The nice thing about git/github is that it feels cheaper to do things, so you don’t worry too much about experimenting. I’ll probably still put bigger commits on Google Code’s SVN, but unfortunately the native windows port of git, msys-git, lacks git-svn so I have to do it manually. Anyway, my github url is  http://github.com/ibrahima , where you can find my meager progress on wii projects. Unfortunately, school is taking up too much of my time but I might try to make a prototype of a windowing system tomorrow.