Last active
August 5, 2024 07:29
-
-
Save GrennKren/a724e2ff9d71a113d626bed0719c4cdb to your computer and use it in GitHub Desktop.
Handling git problem and others on Windows Server
This file contains hidden or 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
Client Side: | |
If you get the error message: | |
fatal: ''/D:/project/myrepo'' does not appear to be a git repository | |
when trying to clone a git repository via SSH using OpenSSH on a Windows Server, for example: | |
`$ git clone ssh://[email protected]:22110/D:/project/myrepo` | |
##################################################################### | |
Server side: | |
Make sure D:/project/myrepo has been initialized with `git init`, and change the default shell of OpenSSH from powershell to bash.exe, which comes with git-bash. | |
Open regedit | |
Go to `HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH` and add a new String Value C:\Program Files\Git\usr\bin\bash.exe without double quotes ' " ' |
This file contains hidden or 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
Server (Local repo, has SSH [email protected], and to handle git pull request from sub computers): | |
- create a folder | |
- `$ git init --bare` | |
Main Computer (not the server, to handle git pull from master github): | |
- `$ git clone https://github.com/xxx/yyyy` (the repo from github) | |
- `$ git remote -v` (check origin urls ) | |
should get something like this | |
``` | |
origin https://github.com/xxx/yyyy (fetch) | |
origin https://github.com/xxx/yyyy (push) | |
``` | |
fetch is the one to git pull from master github | |
push is the one to push changed/update | |
- need to change that push into server local repo | |
`$ git remote set-url --add --push origin "ssh://[email protected]/C:/the_location_git_that_was_just_git_init_bare"` (to add) | |
`$ git remote set-url --delete --push origin "ssh://[email protected]/C:/the_location_git_that_was_just_git_init_bare"` (to remove) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment