Push Git Repo From Remote Server To Git

Create repo, example: myproject, at github.com like this https://github.com/<username>/myproject

On github.com, Go to settings --> Developer Settings --> Personal Access Tokens and generate a new token

Copy the above token and save it at some secure place

Go to your project in your Unix shell - cd <path>/myproject

git init
git remote set-url origin https://<token_from_step2>@github.com/<username>/myproject.git
git push origin master

To avoid providing access token for every git push or pull, we can use GCM. Please make sure gcm is installed.

On Linux..(If you have GUI session), you can run following command...

git config --global credential.credentialStore secretservice

or 

git config --global credential.credentialStore plaintext (this will save the credentials in plain text file which is unsecure)

or 

git config --global credential.credentialStore cache (this will store the credentials for 900 seconds) 

To increase the cache timeout, also run following command...

git config --global credential.cacheOptions "--timeout 300"