Working with github.com

One of my pending aims is try to work with git (SCM). Normally, when I am developing , I work with SVN or BZR. From some time ago, I use git only as a way to get source tarballs and nothing else, but now, I think that can try to use git in some minor project to obtain a real experience opinion.
In next lines, I am going to write some little notes about use of git into github.com.
I think that this notes are useful for me, primarly, but can be useful for other git-beginners, too.

Global setup:

Download and install Git
git config –global user.name “Pablo Saavedra”
git config –global user.email saavedra.pablo@gmail.com
Add your public key at github.com

Next steps, creating a new repository:

mkdir awstats-update
cd awstats-update
git init
touch README
git add README
git commit -m ‘first commit’
git remote add origin git@github.com:psaavedra/awstats-update.git
git push origin master

Other way, existing Git Repo:

cd existing_git_repo
git remote add origin git@github.com:psaavedra/awstats-update.git
git push origin master

The last way, importing from Subversion:

git-svn can be used to import as well. Note that there may be issues if you have branches or tags (they won’t be imported over). If you only have a trunk, like many svn repositories, this method should work for you without issue.
First, be sure to create your repository on GitHub
$ git svn clone -s SVN_REPO_URL LOCAL_DIR
$ cd LOCAL_DIR
$ git remote add origin git@github.com:GITHUB_USERNAME/REPO_NAME.git
$ git push origin master
Note that the -s switch implies that your svn repo is set up with the standard branches/tags/trunk structure.
git-svn adds a note to every commit message it copies over from svn. To get rid of that note, add –no-metadata to the command.
You can pull in later commits by running git-svn rebase from within your repo. If you ever lose your local copy, just run the import again with the same settings and you’ll get another working directory with all the necessary git-svn settings saved.

Refers

Advertisements