Note that there are some explanatory texts on larger screens.

plurals
  1. POHow does Git push and pull work with a remote repo/local repo?
    primarykey
    data
    text
    <p>I come from SVN and I am not understanding how the whole Git thing works. I've created a remote repo, cloned the repo in my local machine - if I make changes to files in my local machine and try to push those files to the exact remote repo I cloned from I get an error like this.</p> <p>remote: error: refusing to update checked out branch: refs/heads/master</p> <p>I browsed through some SO questions regarding the same issue and the most popular solution was creating a bare repository and then committing to it. So what happens when I clone from that new repo - would this happen again? Should I keep creating new bare repos for each commit from my local? I'm confused and it will be great if someone can point me in the right direction. I think I am doing this completely wrong.</p> <p>Exact steps I am following: 1) Created a directory in remote server - init as git repo 2) Copied all contents I needed into the server 3) Added the content into git and committed them there 4) Cloned the git repo from remote to my local machine 5) Made a change to a file in my local, added the change to my local and committed it. 6) When I try to push changes made in my local to remote using: git push origin I get the error message. I'm providing the whole error message below.</p> <pre><code>remote: error: refusing to update checked out branch: refs/heads/master remote: error: By default, updating the current branch in a non-bare repository remote: error: is denied, because it will make the index and work tree inconsistent remote: error: with what you pushed, and will require 'git reset --hard' to match remote: error: the work tree to HEAD. remote: error: Auto packing the repository for optimum performance. remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into remote: error: its current branch; however, this is not recommended unless you remote: error: arranged to update its work tree to match what you pushed in some remote: error: other way. remote: error: remote: error: To squelch this message and still keep the default behaviour, set remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'. ! [remote rejected] master -&gt; master (branch is currently checked out) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload