Why I always got "fatal: does not appear to be a git repository" when I use git push,show,fetch,clone.
I use repo to be my bare repository.
git remote add origin user@dev.com:/home/administration/repo
git push origin master
fatal: '/home/administration/repo' does not appear to be a git repository
fatal: Could not read from remote repository.
I have tried many pattern with my remote url.
like
user@dev.com/home/administration/repo
user@dev.com//home/administration/repo
ssh://user@dev.com/home/administration/repo
However,all of the result were the same.
Steps:
-Server(user@dev.com/home/administration/)
$ mkdir repo
$ cd repo
$ git init --bare
Initialized empty Git repository in /home/administration/repo/
$ ls -a
. .. branches config description HEAD hooks info objects refs
-local
$ git clone user@dev.com:/home/administration/repo
warning: You appear to have cloned an empty repository.(repo directory has been created at local)
$ cd repo
$ git remote add origin user@dev.com:/home/administration/repo
$ git remote -v
origin user@dev.com:/home/administration/repo (fetch)
origin user@dev.com:/home/administration/repo (push)
I just remove my .git directory that was created by vsCode at local.
Then it works.
I can clone the repo.
Howerver,I still can't push by vsCode.
When I use vsCode push,it returns
Permission denied, please try again.
Permission denied, please try again.
user@dev.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
I guess it's the password problem with ssh,but I can't type password in vsCode.
I try @VonC's method
My OS is Win10
-local
> ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_rsa_ubuntu.
Your public key has been saved in /home/username/.ssh/id_rsa_ubuntu.pub.
The key fingerprint is:
SHA256:nNnQckFbuegUs4WD3y+7YqwCaDhfUlX2J17jxF7X3FU xenby@demo.com
The key's randomart image is:
+---[RSA 2048]----+
| .o++ .. E|
| . *o+. ..|
| . = *+ o ..|
| . . Ooo+ * +|
| . o Soo..B o.|
|o + o . ..o |
| + o . . . . |
| . . + o |
| ..o .o. |
+----[SHA256]-----+
> cp C:\Users\UserName\.ssh\id_rsa.pub C:\Users\UserName\authorized_keys
-Server
> mkdir ~/.ssh
-local(Windows doesn't exist "ssh-copy-id",so I use scp)
> scp authorized_keys user@dev.com:~/.ssh
user@dev.com's password:
-Server
> chmod 700 ~/.ssh
> chmod 600 ~/.ssh/authorized_keys
After I did these things,I still need to key password when I use ssh user@dev.com....
What is my problem?