Tuesday, May 14, 2013

Create a Git Repository from an existing non-empty directory and Push Files to a Remote Repository

From the terminal (or command line prompt in Windows) goto the non empty directory where you'd like to create a Git Repository

Run the following commands

git init

git add .

git commit -m 'Initialized my Git Repo'

Get the url of your remote repository.

For E.g in case the url is https://xyz@bitbucket.org/xyz/sample_repo.git

Run the following commands

git remote add origin https://xyz@bitbucket.org/xyz/sample_repo.git

git push -u origin master

No comments:

Post a Comment