git push origin master not pushing the files -
i have setup remote git , local git on mac able create git repo (git init myrepo) on remote machine (linux) added few files , committed them no problems (git add , git commit -m "test")
from local able clone repo remote no issues (git clone ssh://user@ip/path)
so far no issues.
i have created few files locally , used git add , commit tried push them remote server using git push origin master
initially received error message , searching around solution run command directly on remote server: git config receive.denycurrentbranch ignore
that fixed issues , able push successfully:
$ git push origin master
git add test.sh git add git* git commit -m "adding 2 new files , updating test.sh" [master 4dd11a0] adding 2 new files , updating test.sh 3 files changed, 109 insertions(+) create mode 100644 githowtourls.txt create mode 100644 git_howto.txt git push origin master counting objects: 7, done. delta compression using 8 threads. compressing objects: 100% (5/5), done. writing objects: 100% (5/5), 1.91 kib | 0 bytes/s, done. total 5 (delta 0), reused 0 (delta 0) ssh://root@ip/path/myrepo ad4a8b2..4dd11a0 master -> master
$ git push -u origin master
branch master set track remote branch master origin. up-to-date
$ git push origin head:master
everything up-to-date
i checked make sure files match
$ git ls-remote origin
52543130bff4f9f37a23b01b0c44c7549ab82dd9 head 52543130bff4f9f37a23b01b0c44c7549ab82dd9 refs/heads/master
$ git ls-remote
from ssh://root@ip/path/myrepo 52543130bff4f9f37a23b01b0c44c7549ab82dd9 head 52543130bff4f9f37a23b01b0c44c7549ab82dd9 refs/heads/master
however when go remote repo (root@ip/path/myrepo) can't see of new files!!! idea doing wrong?
i ran git log on remote server , see notes:
root@ip [myrepo]# git log commit 52543130bff4f9f37a23b01b0c44c7549ab82dd9 author: joe d <myemail@myemail> date: sat mar 22 15:56:30 2014 -0700 adding again, since first time didn't work commit 4dd11a0235cdabe528f8755253989ce85df4fa8b author: joe d <myemail@myemail> date: sat mar 22 15:48:08 2014 -0700 adding 2 new files , updating test.sh commit ad4a8b224989dc2131b6a33f41b95ce8b2a5c96a author: joe d <myemail@myemail> date: sat mar 22 11:33:34 2014 -0700 test commit 956ff16e081587fa59a8cec73fc383744c5c3a5e author: joe d <myemail@myemail> date: sat mar 22 18:32:30 2014 +0000 test
my remote repo:
root@ip [myrepo]# ls -la total 20 drwxr-xr-x 4 root root 4096 mar 22 18:32 . drwxr-x--- 6 joe nobody 4096 mar 22 18:30 .. drwxr-xr-x 8 root root 4096 mar 22 18:38 .git drwxr-xr-x 2 joe joe 4096 mar 21 22:12 images -rw-r--r-- 1 root root 992 mar 22 18:31 index.html
my local repo:
localmachine:myrepo joe$ ls -la total 32 drwxr-xr-x 8 joe 1668562246 272 mar 22 16:42 . drwxr-xr-x 3 joe 1668562246 102 mar 22 11:33 .. drwxr-xr-x 15 joe 1668562246 510 mar 22 16:07 .git -rw-r--r-- 1 joe 1668562246 445 mar 22 16:42 githowtourls.txt -rw-r--r-- 1 joe 1668562246 3291 mar 22 15:56 git_howto.txt -rwxr-xr-x 1 joe 1668562246 81 mar 22 15:43 test.sh drwxr-xr-x 6 joe 1668562246 204 mar 22 11:33 images -rw-r--r-- 1 joe 1668562246 992 mar 22 11:33 index.html
thanks
new note:
ok, wasn't using bare branch sure, think command ran on remote system
git config receive.denycurrentbranch ignore
i have deleted both repos on local , remote , created again (no bare sure)
then attempted push , received error:
localrepo$ git push origin master counting objects: 6, done. delta compression using 8 threads. compressing objects: 100% (5/5), done. writing objects: 100% (5/5), 1.98 kib | 0 bytes/s, done. total 5 (delta 0), reused 0 (delta 0) remote: error: refusing update checked out branch: refs/heads/master remote: error: default, updating current branch in non-bare repository remote: error: denied, because make index , work tree inconsistent remote: error: pushed, , require 'git reset --hard' match remote: error: work tree head. remote: error: remote: error: can set 'receive.denycurrentbranch' configuration variable remote: error: 'ignore' or 'warn' in remote repository allow pushing remote: error: current branch; however, not recommended unless remote: error: arranged update work tree match pushed in remote: error: other way. remote: error: remote: error: squelch message , still keep default behaviour, set remote: error: 'receive.denycurrentbranch' configuration variable 'refuse'. ssh://root@ip/path/myrepo ! [remote rejected] master -> master (branch checked out) error: failed push refs 'ssh://root@ip/path/myrepo'
this time round entered refuse instead of ignore
git config receive.denycurrentbranch refuse
running git push generated new error message:
localrepo$ git push origin master counting objects: 6, done. delta compression using 8 threads. compressing objects: 100% (5/5), done. writing objects: 100% (5/5), 1.98 kib | 0 bytes/s, done. total 5 (delta 0), reused 0 (delta 0) remote: error: refusing update checked out branch: refs/heads/master ssh://root@ip/path/myrepo ! [remote rejected] master -> master (branch checked out) error: failed push refs 'ssh://root@ip/path/myrepo'
how uncheck branch push local remote repo?
you pushing non-bare repo (which works because of receive.denycurrentbranch
being set ignore).
but it possible remote non-bare repo:
- has checked out different branch master (and since pushing master, content of working tree wouldn't change)
- or has checked out commit (meaning in detached head state, can confirm git branch inside repo, see if of branches marked checked out or not).
i have deleted both repos on local , remote , created again (no bare sure)
by default, receive.denycurrentbranch
set 'refuse
', error messages consistent that.
try setting on 'ignore', , since remote repo on master
, push go through.
but won't see file: need post-receive hook checkout working tree or reset head, files appear.
see instance "git: making pushes non-bare repositories safe"
my post-receive hook looks this:
export git_work_tree=.. git checkout -f head
the op reports in comments:
the answer original issue run on remote server:
git config receive.denycurrentbranch ignore
then add
export git_work_tree=.. git checkout -f head
gitrepo<path>/.git/hooks/post-receive
that did trick , able push files local remote repo!!!
Comments
Post a Comment