git - Trying to set up remote repo and push to it, getting confused -
i have local repo set on laptop's hard drive, @ c:\somefolder\.git
. want set remote repo on windows server @ x:\someotherfolder
backup. here steps have taken far:
in
x:\someotherfolder
, opened git bash session , enteredgit clone "c:\somefolder"
. got messagecloning 'somefolder'...done.
in
c:\somefolder
, opened git bash session , enteredgit remote add origin "x:\someotherfolder"
. statement executed without response.made changes in local project files , committed them local repo
git commit -am
.from
c:\somefolder
git bash, enteredgit push origin master
. response is:
--
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.
etc.
i feel set remote incorrectly. should instead?
remote server can bare repository (repository without content).
in order have such repository need create --bare
flag
# create (bare) remote repository git init --bare
now should see content of .git
folder file system of repository , can start using it.
why should remote repository bare repository?
remote repository not have working directory. contains content pushed other local repositories.
to user did down vote , commented out don't need bare repository: don't need convention.
read in here: https://git-scm.com/book/en/v2/git-on-the-server-getting-git-on-a-server
in order set git server, have export existing repository new bare repository – a repository doesn’t contain working directory.
this straightforward do.
in order clone repository create new bare repository, run clone command --bare option.
Comments
Post a Comment