简体   繁体   中英

How do you get a git project without git-clone?

I'm trying to get started using git. Our project is in a directory with a base development system. I've got it set up great for myself, but I can't get the files over to my collaborators.

We can't do a git clone since it has to clone to an empty directory.

I tried initializing a repository in the dev directory on one of the systems, adding a remote to my repo, then running git-fetch. It did a lot of computing and downloading, but in the end, .git/ ended up with lots of stuff, but the files in the dev directory remain untouched. ls-files shows nothing.

I expected the fetch to pull down all the files. What am I misunderstanding here?

git fetch will only update the remote namespace of your dev repo.
Its working tree will remain untouched (that is "empty", except for all the legacy and private files already there)

Did you try git pull ?
It would git fetch and git merge the remote content into your master branch, filling your working tree in the same time.

It's really unclear what you're describing in this question. Do you already have git repository setup? If 'yes', then what is the exact reason you can not clone from it? If 'no', then the first think you need to do is:

cd project/
git init
git add --all
git commit -m "Initial commit"

Use git-bundle that can transfer the whole repo contents in a archive.

For the docs

Some workflows require that one or more branches of development on one machine be replicated on another machine, but the two machines cannot be directly connected, and therefore the interactive git protocols (git, ssh, rsync, http) cannot be used. This command provides support for git fetch and git pull to operate by packaging objects and references in an archive at the originating machine, then importing those into another repository using git fetch and git pull after moving the archive by some means (eg, by sneakernet). As no direct connection between the repositories exists, the user must specify a basis for the bundle that is held by the destination repository: the bundle assumes that all objects in the basis are already in the destination repository.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM