我如何拉到裸仓库? [英] how do I pull to a bare repository?

查看:105
本文介绍了我如何拉到裸仓库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主裸仓库和一个个人仓库。我想将更改格式main更新为personal,所以我运行:

  $ git pull 
致命:/ home / gimenero / applib / git / libexec / git-core / git-pull不能在没有工作树的情况下使用。

如何将更改推送到main?
<解决方案 git pull 执行 fetch ,然后一个 merge ,并且不能在没有工作树的情况下合并。 (如果出现合并冲突,将无处可解。)



相反,您可以只读取。假设您的主存储库在您的个人存储库中被配置为远程调用来源:

  $ git fetch origin master:master 

请注意,只有当您的个人存储库的主分支镜像主存储库的主分支时才会成功。否则,Git会拒绝非快进提取。


I have a "main" bare repository and a "personal" bare repository. I want to update changes form "main" to "personal", so I run:

$ git pull
fatal: /home/gimenero/applib/git/libexec/git-core/git-pull cannot be used without a working tree.

How do I pull the changes pushed to "main"?

解决方案

A git pull does a fetch followed by a merge, and you can't merge without a working tree. (There would be nowhere to resolve merge conflicts if they should arise.)

Instead, you could just fetch. Assuming your main repository is configured as a remote called origin on your personal repository:

$ git fetch origin master:master

Note that this will only be successful if the master branch of your personal repository is mirroring the master branch of the main repository. Otherwise, Git will reject the non-fast-forward fetch.

这篇关于我如何拉到裸仓库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆