This is a continuation of my notes on installing Ubuntu 16.04. In this post, I install the programs that I use for programming and technical work.
I found a cool little trick today. The file permissions are making git think that the file changed. There is a simple command that tells it to ignore those changes:
git config core.filemode false
I recently switched to Host Gator, and they have policy about the number of inodes. I just noticed that my account moved to “Not Backed Up” just recently. So, I thought I would blog a few of the things I learned while exploring…
I found this command would do the trick:
find . -printf "%i\n" | sort -u | wc -l
One of the advantages of Host Gator is that they provide SSH access. I was able to login quickly and run the command in the different directories. If you have a host that doesn’t offer SSH access, may I suggest PHP Shell?
I had a rough guess that my git repositories might be part of the culprit. If it’s based on the number of files, I guessed that git uses a bunch to track changes. So, I did a little tinkering.
Sure enough, most of the inodes in my project are in the .git directory:
$ find . -printf "%i\n" | sort -u | wc -l 2050 $ find .git -printf "%i\n" | sort -u | wc -l 1195
I found a few options to try. First, I tried the fsck command, but that didn’t seem to make a difference in the inodes:
$ git fsck --full Checking object directories: 100% (256/256), done. dangling commit 9e18c6e42e3f62127776bdd2f52608f904991e08 $ find .git -printf "%i\n" | sort -u | wc -l 1195
Next, I tried the gc command, and that seemed to make all the difference in the world:
# git gc --prune=today --aggressive Counting objects: 912, done. Delta compression using up to 16 threads. Compressing objects: 100% (900/900), done. Writing objects: 100% (912/912), done. Total 912 (delta 525), reused 0 (delta 0) $ find .git -printf "%i\n" | sort -u | wc -l 37
The repack didn’t do much:
# git repack Nothing new to pack. $ find .git -printf "%i\n" | sort -u | wc -l 37
My next culprit is the WordPress Cache. For example, on one of my blogs, the cache accounts for 76% of the inode count.
$ find . -printf "%i\n" | sort -u | wc -l 23323 $ find wp-content/cache/ -printf "%i\n" | sort -u | wc -l 17766
Well, that is another task for another day. This is where I will start though. If you have any ideas, please comment.
This is a continuation of my Ubuntu 12.04 installation notes. I had a few programs that I use that just didn’t belong in any of the other posts. So, they made it to this post.
First, let me just check my installation:
skp@pecan:~$ svnsync --version svnsync, version 1.5.4 (r33841) compiled Aug 7 2009, 01:44:11 Copyright (C) 2000-2008 CollabNet. Subversion is open source software, see http://subversion.tigris.org/ This product includes software developed by CollabNet (http://www.Collab.Net/). The following repository access (RA) modules are available: * ra_neon : Module for accessing a repository via WebDAV protocol using Neon. - handles 'http' scheme - handles 'https' scheme * ra_svn : Module for accessing a repository using the svn network protocol. - with Cyrus SASL authentication - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme
Here are some other quick discoveries that I found:
You can get help by typing
This will give the list of commands supported: init, sync, and copy-revprops. Then, you can get help on a specific command, such as init, with:
svnsync help init
One of the things I noticed was this warning which has me worried because I have already started committing to the repository with git:
You should not commit to, or make revision property changes in, the destination repository by any method other than 'svnsync'. In other words, the destination repository should be a read-only mirror of the source repository.
So, lets go for it.
First, I am going to make my local repository:
mkdir project-sarah git svn clone --username myusername https://project-sarah.googlecode.com/svn/trunk
Now, I am going to try to initialize the syncing:
svnsync init --username myusername --password mypassword https://project-sarah.googlecode.com/svn file://home/skp/app/git-workspace/project-sarah
Here is the message I got back:
svnsync: Cannot initialize a repository with content in it
So, I guess unless I want to try to get Google Code to delete the repository and start over, I am out of luck here. Maybe this will help someone else though.
I did an earlier post where I did this, but I felt like it was sloppy. Also, I did not add files to be ignored. So, here is how to add an existing Eclipse project to Git:
Step 1: In a terminal, change directories to your Eclipse workspace and project (assuming it is called my-project)
Step 2: intialize the repository
Step 3: add any files you want to ignore — consider any test data that might contain real production data and also consider connection information
Assuming you have an Apache Derby database called db, you would exclude all of the database and the log with the following two lines:
If you want to exclude Eclipse specific files, you may choose to add the following two lines:
Step 4: Add your files to your new Git repository
git add .
Step 5: Commit your files to the repository
git commit -m "My-Project inital code"
Step 6: Tag your code with a version
git tag v1.0
Update: You may want to tag this way so other developers see your tag (thanks Dominic):
git tag -a -m "GIT v1.0" v1.0
Now, your git repository is created and contains the code from your Eclipse project.
This started because I wanted to share a program I had been working on through Google Code.
First, I created the git repository by:
skp@pecan:~/app/workspaces/pscompare$ cd ProjectSarah/
bin derby.log export.xml lib src timedb
skp@pecan:~/app/workspaces/pscompare/ProjectSarah$ git init
Initialized empty Git repository in /home/skp/app/workspaces/pscompare/ProjectSarah/.git/
skp@pecan:~/app/workspaces/pscompare/ProjectSarah$ git add .
Then, I did a commit:
skp@pecan:~/app/workspaces/pscompare/ProjectSarah$ git commit -m “First Release”Created initial commit 87fa855: First Release
196 files changed, 3456 insertions(+), 0 deletions(-)
create mode 100644 .classpath
create mode 100644 .project
create mode 100644 bin/com/skp/ProjectSarah/ChangeClientButton.class
create mode 100644 bin/com/skp/ProjectSarah/ClientListener.class
create mode 100644 bin/com/skp/ProjectSarah/CreateTimeViewExcel.class
create mode 100644 bin/com/skp/ProjectSarah/CreateTimesheetsButton.class
create mode 100644 bin/com/skp/ProjectSarah/DateField.class
Now, I created a new directory and started following these directions. One of the problems I had was logging in. I had to use the “My Profile” link on the upper right hand corner of Google Code. That showed what my username was, and then, the password was on the Settings tab.
git svn clone –username <username> https://project-sarah.googlecode.com/svn/trunk
git fetch ~/app/workspaces/pscompare/ProjectSarah/
git branch tmp $(cut -b-40 .git/FETCH_HEAD)
git tag -a -m “Last fetch” last tmp
INIT_COMMIT=$(git log tmp –pretty=format:%H | tail -1)
git checkout $INIT_COMMIT .
git commit -C $INIT_COMMIT
git rebase master tmp
git branch -M tmp master
git svn dcommit
Now, I was able to browse the source of my program online!