github - Git unable to update clean working directory -


i have git setup on machine, , it's been doing strange.

i'll start scratch.

[nighthawk]$ cd ~ [nighthawk]$ rm -rf ./www [nighthawk]$ ls maildir  logs [nighthawk]$  

now clone repository.

[nighthawk]$ git clone https://key:@github.com/user/repo.git ./www cloning ./www... remote: counting objects: 260, done. remote: compressing objects: 100% (195/195), done. remote: total 260 (delta 82), reused 217 (delta 47) receiving objects: 100% (260/260), 7.41 mib | 4.88 mib/s, done. resolving deltas: 100% (82/82), done. [nighthawk]$ cd www [nighthawk]$ git status # on branch master nothing commit (working directory clean) [nighthawk]$  

now can see it. it's there.

i'm going make change readme file, , pull changes onto machine.

this strange:

[nighthawk]$ git status # on branch master # changed not updated: #   (use "git add <file>..." update committed) #   (use "git checkout -- <file>..." discard changes in working directory) # #   modified:   readme.md # # untracked files: #   (use "git add <file>..." include in committed) # #   public/readme.md no changes added commit (use "git add" and/or "git commit -a") [nighthawk]$  

it seems the .git folder updated, checked out directory directory not. also: the file public/readme.md file not exist in repository. exists in ~/www (the root of repository).

i've tried think of setting file permissions, i'm still baffled. how can git update checkout?

thanks in advance!

ps: machine's git version 1.7.2.5.

update:

this how edited readme.md file in root of repository:

modifying:

on separate computer: squid:repo jonn$ vim readme.md squid:repo jonn$ git add -a squid:repo jonn$ git commit -m "edited readme again." [master e2a4d36] edited readme again.  1 file changed, 1 insertion(+), 1 deletion(-) squid:repo jonn$ git push origin warning: push.default unset; implicit value changing in git 2.0 'matching' 'simple'. squelch message , maintain current behavior after default changes, use:    git config --global push.default matching  squelch message , adopt new behavior now, use:    git config --global push.default simple  see 'git config' , search 'push.default' further information. (the 'simple' mode introduced in git 1.7.11. use similar mode 'current' instead of 'simple' if use older versions of git)  counting objects: 5, done. delta compression using 4 threads. compressing objects: 100% (3/3), done. writing objects: 100% (3/3), 386 bytes | 0 bytes/s, done. total 3 (delta 0), reused 0 (delta 0) https://github.com/user/repo.git    882a196..e2a4d36  master -> master squid:repo jonn$  

pulling:

then webhook www/public/deploy.php page called following command:

echo shell_exec('git --git-dir=/home/jonn/www/.git pull origin'); 

output:

updating 882a196..e2a4d36 fast-forward  readme.md |    2 +-  1 files changed, 1 insertions(+), 1 deletions(-) 

it seems .git folder updated, checked out directory directory not.
also: file public/readme.md file not exist in repository. exists in the ~/www (the root of repository).

considering clone repo (in ~/www), seems normal status shows public/readme.md "untracked".

one simple way maintain consistency in git repo content edit (or add) .gitignore in ~/www , add:

/public/ 

in order ignore public folder entirely.

the op jonn adds:

for reason changes made /readme.md pulled subdirectory /public/readme.md (which didn't exist before).

i advise use --work-tree parameter in order sure of worktree location updated git pull:

echo shell_exec('git --git-dir=/home/jonn/www/.git --work-tree=/home/jonn/www pull origin'); 

with recent version of git (1.8.5), specified as:

echo shell_exec('git -c /home/jonn/www pull origin'); 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -