git woes:使用cygwin创建具有文件访问权限的存储库

时间:2018-10-05 17:47:05

标签: git cygwin

使用cygwin git。 --version报告2.17.0。分享,并已成功使用现有存储库。需要创建一个新的仓库,并创建它:

cd /cygwin/y/path/to/repos
mkdir newrepo.git
git init --bare

然后将共享放回我的工作地点,然后:

cd /cygwin/c/path/to/sources
mkdir newrepo
cd newrepo
git init
git remote add origin /cygwin/y/path/to/repos/newrepo.git
cp ../.gitignore ./
git add .gitignore 
git commit -m "Set up the repo"
git push -u origin master

就像我之前所做的一样(尽管这可能是cygwin的第一次)。然后发出:

Counting objects: 3, done.
Writing objects: 100% (3/3), 249 bytes | 83.00 KiB/s,    done.
Total 3 (delta 0), reused 0 (delta 0)
remote: fatal: not a git repository: '.'
fatal: not a git repository: '.'
To /cygwin/y/path/to/repos/newrepo.git/
 ! [remote rejected] master -> master (missing necessary objects)
error: failed to push some refs to '/cygwin/y/path/to/repos/newrepo.git/'

git remote -vv显示:

origin /cygwin/y/path/to/repos/newrepo.git/ (fetch)
origin /cygwin/y/path/to/repos/newrepo.git/ (push)

和.git / config如下:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
[remote "origin"]
        url = /cygdrive/y/path/to/repos/newrepo.git/
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

我的带有错误消息的google-fu仅显示了有关使用git行为的脚本的信息。从来不需要它,也从未碰过它。为了完整起见,发出“ env | grep -i git”不会显示任何内容。

我还经历了克隆裸仓库的过程,而不是创建目录和“ init / remote add”,结果相同。还使用了file://命名法。所有结果都相同。

那么,为什么是“。”不是git repo?到那时候怎么回事?

编辑:与回购在共享驱动器上有关。在本地驱动器(/ cygdrive / c / path / to / repo /而不是/ cygdrive / y / path / to / repo /)上再次尝试所有这些操作,效果很好。

1 个答案:

答案 0 :(得分:0)

回答我自己的问题,因为我的google-fu仍然找不到任何东西,并且我找到了一个可行的(尽管很笨拙)的解决方法。

为Windows安装git(或使用mingwwin的任何东西)。在共享目录中用这个('git init --bare')创建仓库。使用cygwin克隆并重新填充源树。看起来可以工作。已使用cygwin检入代码并将其克隆到其他计算机上,一切都很好。

作为参考,git for Windows报告:

$ git --version
git version 2.19.1.windows.1

cygwin的git报告:

$ git --version
git version 2.17.0
相关问题