Skip to content

Instantly share code, notes, and snippets.

@zarankumar
Created April 19, 2017 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zarankumar/5391f7633fa739510616851b00f3820f to your computer and use it in GitHub Desktop.
Save zarankumar/5391f7633fa739510616851b00f3820f to your computer and use it in GitHub Desktop.
How to convert existing non-empty directory into a Git working directory and push files to a remote repository
cd <localdir>
git init
git add .
git commit -m 'message'
git remote add origin <url>
git push -u origin master
Fetch from remote
git init
git remote add origin PATH/TO/REPO
git fetch
git checkout -t origin/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment