开发者

cloning git repository on thumbdrive

I already have a local workig space repository in /applications/mamp/htdocs/myproject/.git and i can't figure out how to clone it onto a folder in my thumbdrive and use that as my remote to push to.

do i have to create a bare git repository in the directo开发者_C百科ry on my folder first? and then clone my working space one to it?

or do i just cd into my directory on my thumbdrive(with no .git directory) and clone the working space repo to it which would automatically create the .git repo on the thumbdrive?

i'm confused on the proper steps to use my thumbdrive as my remote repo

my thumbdrive's path is "volumes/thumbdrive/"

now i'm trying to add my remote but i can't seem to get the path right i guess...

David-Adamss-MacBook-Pro:myproject davidadams$ git remote add flashstick /volumes/thumbdrive/repo/.git
David-Adamss-MacBook-Pro:myproject davidadams$ git remote
flashstick
thumdrive
David-Adamss-MacBook-Pro:myproject davidadams$ git push flashstick master
fatal: '/volumes/thumbdrive/repo/.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

and this didn't work either

David-Adamss-MacBook-Pro:myproject davidadams$ git remote add flashdrive /volumes/thumbdrive/repo
David-Adamss-MacBook-Pro:myproject davidadams$ git remote
flashdrive
flashstick
thumdrive
David-Adamss-MacBook-Pro:myproject davidadams$ git push flashdrive master
fatal: '/volumes/thumbdrive/repo' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
David-Adamss-MacBook-Pro:myproject davidadams$ 


Clone the local repository into your volumes/thumbdrive and then setup remotes to this newly cloned repo from the old one

`git remote add thumbdrive volumes/thumbdrive`

The remote name after above would be thumbdrive ( use origin if you want ) and you can push like

`git push thumbdrive master`

Another approach:

Copy / move /applications/mamp/htdocs/myproject/.git to the thumbdrive and then clone it back to the desired location.


The best way to do this is to cd to /volumes/thumbdrive/repo directory and then:

git clone --bare /applications/mamp/htdocs/myproject/

This will clone the repo, but won't make any working copies on the thumbdrive. If you look at the remote, you'll see one directory created, called myproject.git, which is probably what you want.

Then from your local git repo:

git remote add thumbdrive /volumes/thumbdrive/repo/myproject.git

After you make changes, you can:

git push thumbdrive master


Go to volumes/thumbdrive/, then:

git clone /applications/mamp/htdocs/myproject/

From then on, you can just push things to volumes/thumbdrive, or pull from /applications

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜