Created
January 15, 2021 12:34
-
-
Save oropesa/cbb0cc2524cbd4c51dc0cb2425ebe970 to your computer and use it in GitHub Desktop.
Git Repository in Windows - All in Local
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/7632454/how-do-you-use-git-bare-init-repository | |
# I use this workflow to work with Git in a Windows Server (with several user accounts) only in Local mode. | |
# 1. Initialise the bare repo | |
> git init --bare "C:/git-repositories/chacho.git" | |
Initialised empty Git repository in C:/git-repositories/chacho.git/ | |
# 2a. Create a new working folder (no existing files) by cloning the empty repo | |
> git clone "C:/git-repositories/chacho.git" "C:/workplaces/chacho-project/master/" | |
Cloning into 'C:/workplaces/chacho-project/master/'... | |
warning: You appear to have cloned an empty repository. | |
done. | |
> cd "C:/workplaces/chacho-project/master/" | |
> git status | |
On branch master | |
Initial commit | |
nothing to commit (create/copy files and use "git add" to track) | |
# But there is no branch-master yet. Add some files. | |
> git add . | |
> git commit -m "INIT project" | |
[master (root-commit) 614ab02] INIT project | |
1 file changed, 1 insertion(+) | |
create mode 100644 chacho.txt | |
> git push origin master | |
# Now it's done. | |
# 2b. Create a working folder from existing files | |
> cd "C:/workplaces/chacho-project/master/" | |
> git init | |
Initialised empty Git repository in C:/workplaces/chacho-project/master/ | |
> git add . | |
> git commit -m "INIT project" | |
[master (root-commit) 614ab02] INIT project | |
0 files changed, 1431 insertions(+) | |
> git remote add origin "C:/git-repositories/chacho.git" | |
> git push -u origin master | |
Counting objects: 31, done. | |
Delta compression using up to 4 threads. | |
Compressing objects: 100% (31/31), done. | |
Writing objects: 100% (31/31), 43.23 KiB | 0 bytes/s, done. | |
Total 31 (delta 11), reused 0 (delta 0) | |
To C:/git-repositories/chacho.git | |
* [new branch] master -> master | |
Branch master set up to track remote branch master from origin. | |
# 3. Clone the project for each user to develop. Project Master is used only for pull. | |
> git clone "C:/git-repositories/chacho.git" "C:/workplaces/chacho-project/oropesa/" | |
> git clone "C:/git-repositories/chacho.git" "C:/workplaces/chacho-project/carlos/" | |
... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment