Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8911811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:02:21+00:00 2026-06-15T04:02:21+00:00

I would like to sync my git repository on my server to my local

  • 0

I would like to sync my git repository on my server to my local webserver. All the guides I read caused different errors and now I’m really desperate. I’m sorry if you already read this question a hundred times, but I still don’t get it -.-

  • Working with Linux SuSE and conneting on it with PuTTY via SSH
  • the webprojekt where I need the sync is on the folder: /srv/www/htdocs/my_project
  • the git repository is here: /srv/git/repository/my_project
  • I have the users: “root” and “cron”

The cron should do this commands every minute or less with the user “cron”:

cd /srv/www/htdocs/my_project
git pull origin
(git fetch) <-- not mandatory

These commands work fine when I input them manually. (except I have to enter the user password every time)

In this question I got some informations, but I always get an error when I try them myself.

My cron should look like this then:

* * * * * su -s /bin/sh cron -c 'cd /srv/www/htdocs/my_project && /usr/local/bin/git pull origin master' 

I executed this on my PuTTY, which answered me: -bash: bin: command not found

My next try was:

crontab * * * * * su -s /bin/sh cron -c 'cd /srv/www/htdocs/my_project && /usr/local/bin/git pull origin master'

Error: crontab: invalid option — ‘s’

Error: crontab: usage error: unrecognized option

I tried a lot more combinations (removing the su -s or removing the -c etc.) but it never worked as I wanted -.- Shouldn’t I do this command on PuTTY?

Good to know: I’m a linux and GIT beginner, started working with it yesterday and actually managed to do a lot til now. (^.^) So I would be happy to have an understandable explanation, in what I do wrong and what I have to do. It’s confusing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:02:22+00:00Added an answer on June 15, 2026 at 4:02 am

    The easiest way to achieve what you want (have the git repository automatically deployed on your server) is by putting the git repository inside you webserver and using a hook to do a check out on push. How to this is described in this answer: Deploy a project using Git push

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On the production server I would like to sync the db. If I just
Would like to be able to set colors of headings and such, different font
I would like to add a GestureDetector to all views (view groups) of an
What I want to do is pretty simple. I would like to have sync
I would like know , what is the best way to sync/load tree panel
I would like to sync my db (tasks on my db, that have a
i have to use a subversion repository and i'd like to use git-svn. I
I have two mysql databases which I would like to sync every couple of
I am currently building my Core Data model, which I would like to sync
I would like to sync a single table with the result of a Join

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.