Pushing to git repository without SSH key?

14,006

Solution 1

You can do this in other way by using HTTP link. The following are the steps to follow

  • git remote add [shortname] [httpurl]

    shortname - short name for your remoteurl(eg:origin, originhttp ..etc)

    httpurl - here you have to provide your remote http url

  • git push shortname master - use this command to push your code.

    shortname - shortname for your remoteurl

Solution 2

Yes, it is possible to copy the SSH key to another machine, but yes, you will need the passphrase for it if you protected the key file.

But instead of copying the key, just make a new one on the laptop and add it to the list of authorized keys on the server. That way, you can revoke it if you sell or lose the laptop.

Share:
14,006
Corsair
Author by

Corsair

Updated on July 24, 2022

Comments

  • Corsair
    Corsair almost 2 years

    I have a personal git server set up for my private projects and created an SSH key on my home machine which was registered on the server. Because I'm currently traveling a lot I cloned some of my repos on my laptop to be able to work on my private projects during my free time. Clonig of these Repos was no problem.

    Now I made some changes which are also listed when calling git status. But when I wanted to push the changes I made to my server using the following commands (embedded in a batchfile):

    git add * --all
    git commit -m "Commit of %fullstamp%"
    git push origin master
    

    I only got the following message: Everything up-to-date, altough the password authentication for the remote git user works properly.

    By now I think I figured out the reason for this behaviour is the fact, that I forgot to copy the SSH key from my home machine over to my laptop. Now I got two questions:

    • Is it possible to just copy the SSH key from my home machine(Win 7) over to my laptop(Win8)?
    • If not, what can I do to make it work properly on both machines? I don't remember which passphrase I used when I created the SSH key for my home machine.