Aran
Aran

Reputation: 3338

Push Git Project to Local Directory

Don't know whether this is fully supported in Git would be excellent if it is as it could make things a lot easier, basically I have a project am working on in folder X and when I get it to a particular stage I want to push it to folder Y on my computer again.

If this is possible great, what would be evener better is whether it is possible with either GitHub for Mac or Tower for Mac.

Upvotes: 32

Views: 18019

Answers (2)

manojlds
manojlds

Reputation: 301437

I would assume that you want to push to Y so that you can have a checked out folder of the "previous good" changes elsewhere. The answer from @dahlbyk suggests a bare repo. If you are going that way, you can ( and probably should) rather have a branch in the same repo.

Other than that, just clone the git repo in X into Y ( non-bare ) and either git pull from Y or setup a remote like @dahlbyk from X and push to Y. Make sure receive.denyCurrentBranch is set to false or a different branch from the branch you are pushing is checked out in Y

Upvotes: -2

dahlbyk
dahlbyk

Reputation: 77590

It is absolutely possible - what you probably want to do is create a "bare" git repository in folder Y (git init --bare) and then add that file location as a remote:

git remote add Y file:///path/to/Y

I assume GitHub for Mac or Tower for Mac would handle this like any other remote.

Upvotes: 43

Related Questions