1

I have a local git repository on my mac. I push my commits always to my git repository on github.

Now I finished my work and I want to push everything to my clients server (linux).

I follow this tutorial https://www.codesolutions.de/git-repository-lokal-erstellen-und-dann-auf-den-server-uploaden/

  1. I uploaded everything to my server like this:

    scp -r projectname.git user@meinserver.de:/home/meine-git-repositories/

  2. I created a new branch like this:

    git remote add mynewbranch ssh://user@meinserver.de:home/meine-git-repositories/projectname.git

Everything worked fine until now.

When I try:

git push mynewbranch master

I get the error message:

Could not resolve hostname meinserver:html: nodename nor servname provided, or not known

I checked the .ssh/config and everything looks fine. I am also able to connect via ssh to the server. I do not know why it does not work now

peace_love
  • 6,229
  • 11
  • 69
  • 157
  • `git remote add` does not create a *branch*. It creates a *remote*, i.e., a name for another Git repository. The other Git repository must exist by the time you use the name for it. Your `scp -r` is likely to have created a valid repository, but `scp`-ing the `.git` directory around is not a recommended method as it may leave inappropriate configuration settings in place. – torek Aug 13 '22 at 00:37

1 Answers1

1

I checked the .ssh/config and everything looks fin

Your URL should have worked without ~/.ssh/config fie, so double-check it again.

Could not resolve hostname meinserver:html

It looks like the git remote -v or the .ssh/config reference a meinserver:html server hostname, instead of meinserver.de: that would be your issue.


The OP peace-love confirms in the comments:

true! I wrote

git remote add mynewbranch ssh://user@meinserver.de:home/meine-git-repositories/projectname.git

instead of:

git remote add mynewbranch ssh://user@meinserver.de:/home/meine-git-repositories/projectname.git
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • true! I wrote `git remote add mynewbranch ssh://user@meinserver.de:home/meine-git-repositories/projectname.git`instead of `git remote add mynewbranch ssh://user@meinserver.de:/home/meine-git-repositories/projectname.git` – peace_love Sep 02 '22 at 08:33
  • @peace_love Thank you for your feedback. I have included your comment in the answer. – VonC Sep 02 '22 at 14:31