Push Git Project to Local Directory

后端 未结 2 1969
孤城傲影
孤城傲影 2021-02-05 06:07

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 whe

相关标签:
2条回答
  • 2021-02-05 06:18

    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

    0 讨论(0)
  • 2021-02-05 06:30

    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.

    0 讨论(0)
提交回复
热议问题