简体   繁体   中英

Creating a local git repository instead of using github

I know that in project x you can do git init but what about creating a place to push too locally? So for example I use drop box and I want to create a git repo there that I can do git push drop-box

I did: git init --bare in the drop box folder and then tried doing:

git add remote origin "/Users/Adam/Documents/rpg maker/the-child-and-the-poet-repo/"
fatal: /Users/Adam/Documents/rpg maker/the-child-and-the-poet-repo/: '/Users/Adam/Documents/rpg maker/the-child-and-the-poet-repo/' is outside repository

But as you can see this didn't work. Ideas?

The link I provided in the comment above is the way to go for DropBox, but I thought it might be useful to have a more general set of instructions for creating a local Git repository, so here it is.

You can initialize a local Git repository with just three commands. From your C:/ drive (on Windows) type:

mkdir newrepo.git
cd newrepo.git
git init --bare

Now you can clone a copy of your local repository to another local location:

git clone C:\newrepo.git newrepo

The git clone command will clone newrepo into a directory called /newrepo . It will initialize a .git directory inside of it, and pull down the entire repository content. In addition, it will check out a working copy (usually master ), and this is the branch on which you will begin.

You are now ready to start working, and all the usual Git commands are fair game from this point forward.

Please have a look at this great blog for more information.

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