昨天,我发布了一个关于如何将Git存储库从我的一台机器克隆到另一台机器的问题,如何从另一台机器"克隆"?.
我现在能够成功地将Git存储库从我的源(192.168.1.2)克隆到我的目标(192.168.1.1).
但是,当我对文件,a git commit -a -m "test"和a 进行编辑时git push,我在目的地(192.168.1.1)上收到此错误:
git push
hap@192.168.1.2's password:
Counting objects: 21, done.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1010 bytes, done.
Total 11 (delta 9), reused 0 (delta 0)
error: refusing to update checked out branch: refs/heads/master
error: By default, updating the current branch in a non-bare repository
error: is denied, because it will make the index and work tree inconsistent
error: …Run Code Online (Sandbox Code Playgroud) 当我使用我的源代码工作时,我做了我惯常的事情提交,然后我推送到远程存储库.但后来我注意到我忘了在源代码中组织我的导入.所以我做了修改命令来替换以前的提交:
> git commit --amend
Run Code Online (Sandbox Code Playgroud)
不幸的是,提交不能被推回到存储库.这被拒绝了:
> git push origin
To //my.remote.repo.com/stuff.git/
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to '//my.remote.repo.com/stuff.git/'
Run Code Online (Sandbox Code Playgroud)
我该怎么办?(我可以访问远程存储库.)