Answers: <p>First, I'd highly recommend not doing this - a better approach would be to have a single source of truth (that is your repo). Force developers to commit &amp; push changes and let the pipeline do the rest. If it's not in repo, it didn't happen.</p>
  <p>If you absolutely have to, then I'd go with &quot;brute-force&quot; way - have a pipeline that triggers periodically (every couple of hours or so) and does a diff of server files against repo files. If something changed, <strike>send a threat email to the developer who did this</strike> sync back to repo.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-04-19T06:51:37.103Z
Answers: 2021-04-19T06:51:37.103Z
Answers: qbik
Body: <p>So I have an azure devops repo and pipeline that copys the repo to my server when changes are pushed. However there are times when some of our developers may make a direct edit to the production server. Is there a way for me to have the azure agent that is installed on the server watch the files for any additions/changes and if/when this happens it pushes the files to the repo?</p>
  <p>I have tried to find a solution for this but have been unsuccessful.</p>
  
Tags: <azure-devops><azure-pipelines>
Title: Watch folder, when direct changes are made push to repo
UserDisplayName: Thee Deer
ThreadText: # Watch folder, when direct changes are made push to repo
  
  (Asked by: username_0 on 2020-12-27)
  
  So I have an azure devops repo and pipeline that copys the repo to my server when changes are pushed. However there are times when some of our developers may make a direct edit to the production server. Is there a way for me to have the azure agent that is installed on the server watch the files for any additions/changes and if/when this happens it pushes the files to the repo?
  
  I have tried to find a solution for this but have been unsuccessful.
  
  **Tags:** azure-devops, azure-pipelines
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-04-19. Score: 1
  
  First, I'd highly recommend not doing this - a better approach would be to have a single source of truth (that is your repo). Force developers to commit & push changes and let the pipeline do the rest. If it's not in repo, it didn't happen.
  
  If you absolutely have to, then I'd go with "brute-force" way - have a pipeline that triggers periodically (every couple of hours or so) and does a diff of server files against repo files. If something changed, send a threat email to the developer who did this sync back to repo.
  
  
  ---
  
  