Super Spread Sheet S³

Or little computing tricks and hacks

Bare gits

Everytime I do this I have to go to my notes or the Web… It’s time to put it in one place.

I want to create a new repository which is the common or reference point of our data. It can be seen as a back up or just the sanity check. In other words, I want to change where the pushing and pulling is directed. So the remote master origin.

This time the reference point is a zip drive, which should be connected always to the same computer otherwise the URL to reach the gits cannot be fixed. git push and git pull will respectively update the bare repos with local changes and get the latest changes, provided the correct URL is in the configuration file.

There are two ways of the doing the same thing. Choose the one you understand well:

  1. Here you need to clone in the directoty where you are storing the bare repository. Manually, though, you have to change the config file in the .git directory so that the push and pull are automaticly done to this bare repository:
    • Create the directory where all the gits are to be stored, assuming there are more than one.
    • cd to each directory in turn
    • git --bare init
    • In the original directory, after updating the config file to have the bare as the origin and master, push the tree: git push
  2. With only the following command, git creates a bare repository while clonig, assuming you are in the working tree of the repository you want to create a bare copy:
    • git clone --bare full-path-of-the-repository (optional)-name-of-repository
    • git push

To update the config file I commonly use the following method:

  • Manually changing the file with a text editor. You must know what you are doing here.

Another method is by using the git remote command. It has an issue though, that it will also modify the master branch and then when pulling, one must specify the branch at each go.

  1. git remote rename origin new-name
  2. git remote add origin the-url-of-the-bare-repository

I will investigate later and post the workaround to this issue.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: