User Tools

Site Tools


Local git repo sync with github

When we want to have different file content in local repo (example robots.txt file on live server) than the one on github repo

  1. Make the changes on server
  2. git update-index –assume-unchanged filename
  3. Check if modification is tracked with git status (shouldn't be)
  4. Additionally, we can check the list of assume-unchanged files with:
git ls-files -v|grep '^h'

When we want to make sure cross-platform file permission settings are not tracked as modified files by git:

Set filemode to false (filemode = false) in .git/config file. This file is not shared, so make sure to change wherever necessary (server)

When line ending cross-platform differences are causing git to modify files (Warning: LF will be converted to CRLF or vice-versa):

We can change config settings on each repo, or better yet, using shared .gitattributes file

More info here

Sample .gitattributes file when we want to force LF line endings here:

Tested on

See also


wiki/local_git_repo_sync_github.txt · Last modified: 2022/10/03 12:14 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki