kev*_*nmm 5 git msysgit git-bare
我有一个现有的裸Git存储库,它是从CVS导入我们的源代码和历史记录而创建的.我做了一面镜子,使用:
git clone --mirror git://aserver.adomain.com/myrepo
Run Code Online (Sandbox Code Playgroud)
然后,我想将所有分支和标签推送到我们内部的Git repo主机, 但推送似乎并没有将裸存储库视为Git仓库.
我尝试过以下方法:
git clone --mirror git://aserver.adomain.com/myrepo
git remote set-url origin http://user@anotherserver.adomain.com/project/myrepo.git
git push origin
Run Code Online (Sandbox Code Playgroud)
这导致:
$ git push origin
Password for 'xxxx':
error: cannot spawn git: No such file or directory
Run Code Online (Sandbox Code Playgroud)
或者我试试:
$ git remote rm origin
Note: Some branches outside the refs/remotes/ hierarchy were not removed;
to delete them, use:
...a whole lot of branches...
user@SOMEMACHINE /some/path/myrepo.git (BARE:master)
$ ls
HEAD config description hooks info objects packed-refs refs
user@SOMEMACHINE /some/path/myrepo.git (BARE:master)
$ git branch -a
...a whole lot of local branches...
user@SOMEMACHINE /some/path/myrepo.git (BARE:master)
$ git remote add mygithost http://user@anotherserver.adomain.com/project/myrepo.git
user@SOMEMACHINE /some/path/myrepo.git (BARE:master)
$ git push --all mygithost
Password for 'xxxx':
error: cannot spawn git: No such file or directory
Run Code Online (Sandbox Code Playgroud)
"不能产生git"是什么意思?
如何将所有分支机构的裸仓库推送到空的现有仓库?
我已经搜索了几种可能性并回顾了几个SO问题,但我没有看到解决这个问题的方法.显然,我对这个过程的理解是有缺陷的.
我想我的理解并没有缺陷.错误以某种方式误导我认为裸存储库存在问题,因为我可以从"常规"克隆克隆并按分支推送分支.
事实证明,这是MSysGit中的一个错误.我转移到Linux,因为在我的情况下,保留所有历史是必需的.我不能简单地删除分支和标签,因为这些需要被推送到空的远程仓库.所以,以下确实有效:
$ git remote rm origin
$ git clone --mirror git://aserver.adomain.com/myrepo
$ cd /some/path/myrepo.git
$ git remote add mygithost http://user@anotherserver.adomain.com/project/myrepo.git
$ git push --all mygithost
$ git push --tags mygithost
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9553 次 |
| 最近记录: |