version control - git push error between two local respositories -


i have (main)folder 'prj' directories , have git init there creating repo , added , committed files git add *

i have created directory 'prj2' have git init , did git pull copied on 'prj2'

now when make changes files in prj2 repo , commit, git push prj(main) gives error:

remote: error: refusing update checked out branch: refs/heads/master[k remote: error: default, updating current branch in non-bare repository[k remote: error: denied, because make index , work tree inconsistent[k remote: error: pushed, , require 'git r.............

is correct way set main project(prj) , second(prj2) can push main?

and if pushing not possible because main project repo non bare git init..etc, how should 1 push main repo?

or different set better?

the easier way clone main project , configure remote. fact it's local not issue

in other words, instead of initing 2 repos, init --bare 1 , clone it.

or if both need have working copy (i.e. not bare) can make work if both repos not in same branch @ same time. if were, means working copy of prj1 become invalid when prj2 pushed changes (that's why error).

finally, if need in same branch, git wrong tool use since talking more of mirror. in case rsync work better


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -