一个项目可以在Git中有两个(或更多)"起源"吗?
具体来说,添加github存储库时会出现此错误:
$ git remote add origin https://github.com/Company_Name/repository_name.git
fatal: remote origin already exists.
Run Code Online (Sandbox Code Playgroud) 我在/ a和/ b中有2个本地git档案,这些档案是从遥控器/原点克隆的.
/ b上有一个新的分支z
如何从archive/a中跟踪和获取分支z?
我试过这个:
cd /a
git remote add b /b
Run Code Online (Sandbox Code Playgroud)
这会创建2个配置条目,但我没有设法获取某些内容或列出/ a上的远程分支,这将显示/ b上的分支
尝试不同的东西后,我发现以下内容有效:
1)git remote show b列出b中的所有远程分支
2)我可以使用以下语法获取:
git fetch file:///a/ z
其他有用的东西:
$ cd /b
$ git checkout -b z
Switched to a new branch 'z'
$ git pull b z
Run Code Online (Sandbox Code Playgroud)
但那些命令仍然无法工作,我无法理解为什么:
git branch -a
Run Code Online (Sandbox Code Playgroud)
不列出b中的远程分支(onlz显示原始的分支)
git checkout -t b/z
Run Code Online (Sandbox Code Playgroud)
不签出任何内容但返回错误消息
导入我的裸git仓库到Gitlab被描述为在这里,因为它不被视为一个git仓库,而是创建了一个94K的大"空"回购(原来是2,8GB大):
$ bundle exec rake gitlab:import:repos RAILS_ENV=production
fatal: Not a git repository (or any of the parent directories): .git
Processing test.git
INFO: Sidekiq client using redis://localhost:6379 with options:namespace=>"resque:gitlab"}
* Created test (test.git)
Done!
Run Code Online (Sandbox Code Playgroud)
作为一种解决方法,我用我的裸仓库替换空项目文件夹(由导入试用版创建).然后我树从克隆远程克隆repo并得到以下错误:
$ git clone git@mydomain.com:...test.git
Cloning into 'test'
fatal: '...test.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
但是git用户应该拥有所需的所有权限. - 也许我有一些被忽视的东西?
我的系统:RHEL6.3,Git 1.8.3.4,Gitlab5.3.
Gitlab需要一个普通的存储库(非裸)吗?或者我的问题是什么?