Skip to content

Instantly share code, notes, and snippets.

@akilawickey
Last active January 18, 2018 11:30
Show Gist options
  • Save akilawickey/46c75260d98ec28911cc748d773a5ea6 to your computer and use it in GitHub Desktop.
Save akilawickey/46c75260d98ec28911cc748d773a5ea6 to your computer and use it in GitHub Desktop.
Autoupdating Server from remote GitHub repository periodically

First you generate ssh key in the server

  1. ssh-keygen -t rsa -b 4096 -C "[email protected]"
  2. Uploading this public key to deploy keys in GitHub
  3. Then you create /home/user/.ssh/config file
  4. Then you clone repository with git clone https://github.com/akilawickey/akilawickey.github.io.git
  5. create a bash file as sync.sh
  6. Give privilages to the script by chmod +x sync.sh
  7. And then put it in cronjob to make it happen peroidly
  8. just go to terminal and type crotab -e and edit it as following structure this will run the bash script sync.sh in every 1 minute

***** /home/user/scripts/sync.sh

cd /home/user/github/myrepo && git pull
# here put your github repository location which you want to add automatically updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment