Pepe
Pepe

Reputation: 213

Git: push-pull on working copies

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 

Then I cloned this "Myrepo".

git clone C:\Myrepo c:\Newrepo

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.

It's OK.

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

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?


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?

Best regards, Peter

Upvotes: 0

Views: 535

Answers (2)

Adam Dymitruk
Adam Dymitruk

Reputation: 129526

Please set up a remote and pull and push with that. It will make subsequent pushes/pulls/fetches less of a hassle.

edit:

take a look at the manual for:

git remote
git branch
git push

so that you know what the requirements are for regular pushing and pulling to and from repositories. Ie, You don't want to be specifying a full url/path every time you do that.

Upvotes: 0

manojlds
manojlds

Reputation: 301077

From new repo, you can do

git pull origin

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

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: 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.

Upvotes: 1

Related Questions