Wednesday, August 31, 2011

Create new local git repo and add existing code to it

1. create repo
$mkdir /dev/repos/proj.git
$cd /dev/repos/proj.git
$git init --bare

2. add existing code to it
$cd /dev/existingdir
$git init
add any directories/files to be ignored to .gitignore in this directory. create .gitignore if it does not exist
$git add *
$git commit -m "message"
$git remote add origin /dev/repos/proj.git
$git remote update
$git push origin master

No comments:

Post a Comment

Followers