本地目录作为git存储库和工作副本

时间:2014-02-23 15:25:00

标签: git version-control

我想要实现的目标---

我对git知之甚少并试图学习它。我的服务器上没有安装git。

因此,我正在尝试在我的系统中创建一个文件夹( Git Repos文件夹),该文件夹将充当存储库的目录。 (就像在GitHub中创建的存储库一样)和另一个文件夹( Git Clones文件夹),我可以在那里克隆存储库并对它们进行处理。(就像github存储库的本地克隆一样)。

我希望能够从 Git Clones文件夹中的任何存储库提交并推送到 Git Repos文件夹中的相应存储库。

我做了什么 -

我在 Git Repos文件夹中创建了一个名为 praveenpuglia.com 的仓库,并运行git init使其成为git存储库。

接下来,我使用git clone D:/Git Repos Folder/praveenpuglia.com

Git Clones文件夹中将回购列表克隆为 praveenpuglia.com

我放了一个自述文件文件,上传并提交了它。

当我尝试将更改推送到主服务器时,我收到了这些错误

Pushing to D:/Git Repos Folder/praveenpuglia.com
remote: error: refusing to update checked out branch: refs/heads/master[K
remote: error: By default, updating the current branch in a non-bare repository[K
remote: error: is denied, because it will make the index and work tree inconsistent[K
remote: error: with what you pushed, and will require 'git reset --hard' to match[K
remote: error: the work tree to HEAD.[K
remote: error: [K
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to[K
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into[K
remote: error: its current branch; however, this is not recommended unless you[K
remote: error: arranged to update its work tree to match what you pushed in some[K
remote: error: other way.[K
remote: error: [K
remote: error: To squelch this message and still keep the default behaviour, set[K
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.[K
To D:/Git Repos Folder/praveenpuglia.com
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to D:/Git Repos Folder/praveenpuglia.com'

我做错了什么以及如何设置?我在这里尝试了一些可用的答案,但无法理解。

1 个答案:

答案 0 :(得分:1)

如果要推送到远程存储库,则必须将其创建为裸存储库。 您可以通过以下方式将远程存储库转换为裸:

git config --bool core.bare true