Search code examples
gitpushbranchhostnamenodename

How can I push from my local repository to my server via terminal?


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 [email protected]:/home/meine-git-repositories/

  2. I created a new branch like this:

    git remote add mynewbranch ssh://[email protected]: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


Solution

  • 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://[email protected]:home/meine-git-repositories/projectname.git
    

    instead of:

    git remote add mynewbranch ssh://[email protected]:/home/meine-git-repositories/projectname.git