S
S
survivor20052019-05-18 20:38:13
git
survivor2005, 2019-05-18 20:38:13

Does the clone not push to the original folder?

Guys, please tell me what I'm doing wrong. I create a folder on a remote file server, I go there with a git, I create a file there as everyone advises like readme.txt, I tried it on a clean one, then I do git init, git add readme.txt, git commit -m "bla bla bla". My task is to clone this folder on my computer, go to drive C, create a folder like dev, then write while in this folder via git: git clone Z:/testforgit. The drive is connected as a network. And everything seems to be running normally. Then I make changes, commit them and try to push them. I enter git push origin and fail. Here's what it says:
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 281 bytes | 281.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
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: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into
remote: its current branch; however, this is not recommended unless you
remote: arranged to update its work tree to match what you pushed in some
remote: other way.
remote:
remote: To squelch this message and still keep the default behavior, set
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To z:/testforgit
I don't know Git well. Just started studying. But I didn't find a reasonable answer. Help plz.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2019-05-19
@jcmvbkbc

Here he writes a possible solution for you:

You can set the 'receive.denyCurrentBranch' configuration variable
to 'ignore' or 'warn' in the remote repository to allow pushing into
its current branch

Go to your remote server and add to this repository in .git/config
[receive]
denyCurrentBranch = ignore

And if you're going to work on a checked-out branch on a remote server, don't forget to git reset --hard before you start to keep your working directory in sync.

D
Dmitry Shitskov, 2019-05-18
@Zarom

Recreate the repository on the server so that it is bare (clean).
https://githowto.com/en/bare_repositories
PS In my opinion it's better to use git-server variations

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question