我是 Git 新手,有点困惑(今天才开始使用它)。我有以下问题。在工作中,我有 git repo 并将其克隆到我的笔记本电脑上。在家里,我从我的笔记本电脑克隆到我的台式电脑。
工作服务器 -> git clone -> 笔记本电脑 -> git clone -> 台式电脑
因此,在对源代码进行一些更改后,我键入以下命令“git push”。据我了解,我只是推动对本地仓库的更改。然后我尝试'push orgin master'我收到以下错误:
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 289 bytes, done.
Total 2 (delta 1), 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: 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:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
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'.
To user_name@host:~/path/to/folder/.git
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'user_name@host:~/path/to/folder/.git'
在我的笔记本电脑中,我没有看到任何变化。那么在这种情况下我应该怎么做呢?什么是正确的方法?你能更详细地解释一下吗?预先感谢您的回答。