I have a visual studio solution I have been working on. The project may actually be more use full than I fist anticipated, so I want place it in a local git repository.
I also want to make a remote origin (bare repository) on an other (backed-up network) drive.
I have seen a zillion explanations, here on stack and else where, but when I try them the they don't seem to have desired result (don't track, can't push, etc.)
If someone has the correct commands in order of appearance I would be most grateful.
Say my project lives on "D:\projects\myapp" and I want the remote on "G:\remotes\myapp"
The tools at my disposal are: VS2022 community edition GitGUI version 2.34.1.windows.1 GitBash version 4.4.23
UPDATE: I made a test project to try Jessehouwings solution: Turn my project folder into a Git repo: Add Ignore and add the project files: First commit: So far so good:
Then create a bare repository on my backup-ed storage drive:
Add remote to the project repo:
Try to push some changes error message
What did I do wrong? It looks like the path to the remote is not correct:
But how do I specify a local drive there?
I used the script below. Most important part, is to use /
for your remote path.
C:\Users\JesseHouwing\gittest>md repo
C:\Users\JesseHouwing\gittest>cd repo
C:\Users\JesseHouwing\gittest\repo>git init
Initialized empty Git repository in C:/Users/JesseHouwing/gittest/repo/.git/
C:\Users\JesseHouwing\gittest\repo>notepad readme.md
C:\Users\JesseHouwing\gittest\repo>git add readme.md
C:\Users\JesseHouwing\gittest\repo>git commit -m "readme"
[main (root-commit) 293503d] readme
1 file changed, 1 insertion(+)
create mode 100644 readme.md
C:\Users\JesseHouwing\gittest\repo>cd ..
C:\Users\JesseHouwing\gittest>md remote
C:\Users\JesseHouwing\gittest>cd remote
C:\Users\JesseHouwing\gittest\remote>git init --bare
Initialized empty Git repository in C:/Users/JesseHouwing/gittest/remote/
C:\Users\JesseHouwing\gittest\remote>cd ..\repo
C:\Users\JesseHouwing\gittest\repo>git remote add network C:/Users/JesseHouwing/gittest/remote
C:\Users\JesseHouwing\gittest\repo>git push network main
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 218 bytes | 218.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To C:/Users/JesseHouwing/gittest/remote
* [new branch] main -> main