Wednesday, November 06, 2013

Setting up Git for Google code

Suppose you want to create a project in Google code and you want to use Git for your code repositories, this post teaches you how to set up Git repository in Google code.

1. Create a new project in Google code:
Create a new Google code project (

2. Create a .netrc file, this file is a kind of configuration file you use each time when you interact with Google’s Git server, it contains your login details.
$ vi ~/.netrc
# Add the following line into your netrc file
machine login password xxxxx

You can also find this line from:
Google Git settings(

3. Go to your local repository which contains your project:
$ cd project-X

# now we initialize this directory
# but instead of using git init, we use  git --bare init
# "A short aside about what git means by bare: A default git repository assumes that you will be using it as your working directory,
# so git stores the actual bare repository files in a .git directory alongside all the project files. Remote repositories don't need
# copies of the files on the filesystem unlike working copies, all they need are the deltas and binary what-nots of the repository itself. This is what "bare" means to git. Just the repository itself."

$ git --bare init

# Add your development code
$ git add programA.c

# Commit your code change
$ git commit -a -m "ProgramA.c create functions....etc"

# Add to remote project repository
$ git remote add googlecode

# Push the changes into remote repository
$ git push googlecode master
remote: Scanning pack: 100% (8/8), done.
remote: Storing objects: 100% (8/8), done.
remote: Processing commits: 100% (1/1), done.
 * [new branch]      master -> master

Now you changes have been pushed into remote repository. You can use
$ git clone

to verify

No comments: