Creating a local git repo and push it to remote server

Quite often I forget the git quirks.. No, I don’t use github or beanstalk. Personally, I would like to manage my own code and my customer’s code rather than just pushing to a public repo.

Having said that I always create a remote repo of my local repo. And here is the workflow I use:

 

1) Create your local repo in the directory

git init

2) Add some files

git add Resources

3) In remote server also create the directory and initialise a git repo (git init)

4) In local directory, edit your git config file – to add the remote location (edit file .git/config)

[remote "origin"]

fetch = +refs/heads/*:refs/remotes/origin/*

url =   ssh://username@yourserver.com:22/path_created_in_step_3/.git

 

5) You should now be able to push to remote location

git push origin master

Leave a Reply