Getting a working copy of a bare repository

前端 未结 7 711
渐次进展
渐次进展 2020-12-08 09:35

I have a server on which I have a bare repository for pushing. However, my server needs to have a working copy of the master branch.

How do I get a working copy and

7条回答
  •  死守一世寂寞
    2020-12-08 10:18

    This is a riff off the other 2 answers but it fills the gap for my use case -- it works for updating the repo from the origin and checking out branches and any git operation because you end up with a normal complete git repo.

    git clone /path/to/bare/repo /new/path/to/full/repo
    cd /new/path/to/full/repo
    git remote set-url origin git@github.com:swift/swift.git
    

    After executing these 3 lines of code you can then git pull and git branch and git checkout some_branch and so on because you now have a normal complete git repo connected to your remote repo.

提交回复
热议问题