git 问题:使用 cygwin 创建具有文件访问权限的 repo
git woes: create repo with file access with cygwin
使用 cygwin git。 --版本报告 2.17.0。分享一下,并成功使用现有的回购协议。需要创建一个新的 repo,并创建了它:
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 远程 -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 回购?它是如何达到这一点的?
编辑:与存储库位于共享驱动器上有关。在本地驱动器上再次尝试所有这些(/cygdrive/c/path/to/repo/ 而不是 /cygdrive/y/path/to/repo/)并且它工作正常。
回答我自己的问题,因为我的 google-fu 仍然找不到任何东西,我找到了一个可行的(虽然笨拙)解决方法。
为 windows(或者不管它叫什么——使用 mingwwin)安装了 git 东西。在共享目录中使用此 ('git init --bare ') 创建存储库。使用 cygwin 克隆并重新填充源代码树。看起来工作。使用 cygwin 在不同的机器上检查代码并克隆,一切都很好。
供参考,git windows 份报告:
$ git --version
git version 2.19.1.windows.1
cygwin 的 git 报告:
$ git --version
git version 2.17.0
使用 cygwin git。 --版本报告 2.17.0。分享一下,并成功使用现有的回购协议。需要创建一个新的 repo,并创建了它:
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 远程 -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 回购?它是如何达到这一点的?
编辑:与存储库位于共享驱动器上有关。在本地驱动器上再次尝试所有这些(/cygdrive/c/path/to/repo/ 而不是 /cygdrive/y/path/to/repo/)并且它工作正常。
回答我自己的问题,因为我的 google-fu 仍然找不到任何东西,我找到了一个可行的(虽然笨拙)解决方法。
为 windows(或者不管它叫什么——使用 mingwwin)安装了 git 东西。在共享目录中使用此 ('git init --bare ') 创建存储库。使用 cygwin 克隆并重新填充源代码树。看起来工作。使用 cygwin 在不同的机器上检查代码并克隆,一切都很好。
供参考,git windows 份报告:
$ git --version
git version 2.19.1.windows.1
cygwin 的 git 报告:
$ git --version
git version 2.17.0