Latest Post

Error: No input file specified.

While trying to run a codeigniter app the other day I came across this error just after I had finished uploading the files and making the ne...

Tuesday, January 20, 2015

How to init a git repo in an existing staging or production server via SSH

Init the repo
SSH to the server and navigate to the project location
$ rm -fr .git
$ git init
$ git remote add origin your-git-url
$ git fetch
$ git reset --hard origin/master    **

**IMPORTANT NOTE:
git reset --hard
  abandon everything since your last commit; this command can be DANGEROUS.
  If merging has resulted in conflicts and you'd like to just forget about
  the merge, this command will do that.

For pulling future updates from the server:
$ git pull origin master (or whichever branch you are pulling from)

Chitika Ads