githubc9.io

Pushing to GitHub without a key


I am using GitHub and C9 on a work computer and but GitHub will stop reading my SSH key after a few hours. IDK if it is because I am using my work computer (job is not currently programming), but is there a way I can push my code without an SSH key


Solution

  • First, check that your remote URL is indeed an ssh one:

    cd /path/to/my/local/cloned/repo
    git remote -v
    

    If it is (git@github.com:user/repo), check what ssh -Tv git@github.com returns.

    If SSH does not work (because SSH port might be blocked at work), switch to an HTTPS URL:

    git remote set-url origin https://github.com/user/repo
    

    From there, make sure git config credential.helper does reference an helper (like "manager" on Windows), and you will be prompted for your GitHub account username/password at the first push. After that, your credentials will be cached.