Git:在工作副本上推拉 [英] Git: push-pull on working copies

查看:60
本文介绍了Git:在工作副本上推拉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用"Git"进行版本控制.我已经初始化了我的仓库. C:\ Myrepo并提交了几个文件.

I am starting to use "Git" for version control. I've initialized my repo. C:\Myrepo and committed several files.

git init
git add .
git commit 

然后我克隆了这个"Myrepo".

Then I cloned this "Myrepo".

git clone C:\Myrepo c:\Newrepo

我还想将更改从Newrepo拉回Myrepo.

Further I want to pull changes from Newrepo back to Myrepo.

#c:\Myrepo>git pull c:\Newrepo
#From c:\Newrepo
# * branch            HEAD       -> FETCH_HEAD
#Already up-to-date.

没关系.

但是我想将更改从c:\ Myrepo拉到c:\ Newrepo,然后我变得致命,如下所示

BUT the I want to pull the changes from c:\Myrepo to c:\Newrepo then I am getting fatal as follow

#c:\Newrepo>git pull c:\Myrepo
#fatal: 'c:\Myrepo' does not appear to be a git repository
#fatal: The remote end hung up unexpectedly

如何将更改从c:\ Myrepo推送或推送到新形成的存储库?我应该使用什么程序?如何正确使用推/拉?没有裸仓库,有可能吗?我需要以某种方式配置存储库吗?

How can I pull or push the changes from c:\Myrepo to new formed repository? What procedure should I use? How to correct use push/pull? Is it possible without bare repo? Do I need to somehow config the repos?

"push"命令仍然有问题...如何创建回购以接受推送?我是否仍使用"git init"创建仓库,如果无法将其推入该目录? 怎么做推?必须将其初始化为裸"存储库才能启用推送"功能,还是可以推送到工作副本存储库?

Still have problem with "push" command... How to create repo to accept push? I am still creating repo just with "git init" if so I am not able to push to this dir? How to do the push? It must be initialized as "bare" repo to enable "push" or is it possible to push to working copy repo?

最诚挚的问候, 彼得

推荐答案

在新的仓库中,您可以

git pull origin

来源是指向MyRepo的远程指针,克隆时会自动设置.

Origin is the remote pointing to the MyRepo and it is automatically setup when you clone.

我不确定[c3>的工作原理为何git pull c:\Myrepo失败了".但是git pull origin应该为您提供一个更好的主意,以查看您是否在设置时做了一些与从此处发布的内容不明显的不同操作.

I am not really sure why git pull c:\Myrepo failed though git pull c:\Newrepo worked. But a git pull origin should give you a better idea to see if you had done something different while setting up that is not apparent from what you have posted here.

PS:在Git中,没有工作副本的概念.全部都是回购协议,裸(没有工作目录)和非裸回购之间有区别.

PS: In Git, there is no concept of working copies. All are repos, with there being a distinction between bare ( which don't have a working directory) and non-bare repos.

这篇关于Git:在工作副本上推拉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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