Refer to an online article "to build git repository on a USB stick"
1. I often have such needs, work, home need to the same code or document editing, and want to be synchronized in different places;
If the privacy is not so strong, you can directly use the GitHub escrow ha, of course, pay is also private ~ ~
2. First create a repository name on the USB flash drive: Git_mycbb_repos
git init–bare git_mycbb_repos//Bare library, no work directory
3. Re-build a source project name: GIT_MYCBB
Git init GIT_MYCBB
Put files that need to be managed synchronously
git Add. Add files, and if there are files that you do not need to manage, join the. gitignore file;
Git commit-m "initialized." Submit to local Warehouse
git remote add myusb f:/git_mycbb_repos//Adding Git_mycbb_repos on the U-disk as a remote repository
git push Myusb Master
4. Another computer or other place, insert the U-disk
GIT init mygittest//Build a local repository
git remote add myusb f:/git_mycbb_repos//Adding Git_mycbb_repos on the U-disk as a remote repository
Git pull Myusb master//complete code synchronization
U-disk as Git repository, complete code synchronization in different places