0

So i've got my git server setup on AWS, it worked perfectly fine on my mac and ubuntu, but i got trouble connecting it using windows. Here is the steps and the error i got.

Steps:

1. generate keys using "ssh-keygen -t rsa -b 4096"
2. put the key on server using "echo 'sshkey' >> .ssh/authorized_keys"
3. init repo on windows, set remote to "git remote add origin git@git-myserver-GitName.git"
4. setup config file with the public ip:
    Host git-myserver
        HostName <publicIP>
        User git
        IdentityFile ~/.ssh/keyForGitServer
        RequestTTY no

5. git pull origin master

And it gives me the following errors:

fatal: 'git@git-myserver-GitName.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Any suggestions would be appreciated.

libra
  • 673
  • 1
  • 10
  • 30
  • 1
    I believe you'll have to do a git clone before first pull... – dsafcdsge4rfdse Apr 14 '16 at 11:10
  • 2
    `git@git-myserver-GitName.git` is not a valid repository specification. You want `@:`, for example `git@git-myserver.com:path/to/GitName.git`. – larsks Apr 14 '16 at 11:18
  • @larsks thx!, I think this is the solution i'm looking for, i will get back to you when i got it tested on my windows laptop! – libra Apr 15 '16 at 04:29
  • @larsks, it worked!, except i used git-myserver instead of git-myserver.com as host, do you want to move it to answer section so we can close this question? – libra Apr 15 '16 at 13:04

1 Answers1

2

In your question, you said you're using:

git@git-myserver-GitName.git

This isn't a valid repository specification; you need to tell git (a) what username to use, (b) what remote host to use, and (c) what repository on the remote host to use. The canonical format of an ssh repository specification is:

<user>@<remotehost>:<path_to_repository>

So if you are connecting as the git user to myserver.example.com and accessing the /repos/myrepo.git repository, you would use:

git remote add origin git@myserver.example.com:/repos/myrepo.git

For repositories that are relative to your remote home directory you can use relative paths:

git remote add origin git@myserver.example.com:myrepo.git

You can also specify an SSH remote as:

ssh://<user>@<remotehost>/<repository>

More information is in the documentation.

larsks
  • 277,717
  • 41
  • 399
  • 399