Skip to content
Go back

Configure git submodule for no password (ssh)

| Last edited: Yesterday

If you are leveraging [git submodule for Hugo themes]({{< ref “git-submodule-for-hugo-themes.md” >}}) and you are accustomed to using git without passwords (via ssh urls), you’ll find that when you add a git submodule, it will be setup for “https urls” and thus prompt you for a password:

{{< highlight bash “style=emacs” >}} $ git push origin master Username for ‘https://github.com’: {{< /highlight >}}

This is obviously annoying but easy to fix. You can check the urls for your origin with git remote -v:

{{< highlight bash “style=emacs” >}} $ git remote -v origin https://github.com/ahoog42/Mainroad (fetch) origin https://github.com/ahoog42/Mainroad (push) {{< /highlight >}}

and then simply update the origin with the ssh url:

{{< highlight bash “style=emacs” >}} $ git remote set-url origin git@github.com:ahoog42/Mainroad.git {{< /highlight >}}

Now when you git push origin master, the push will occur over ssh and viola, no more passwords.


Share this post on:

Previous Post
Diff for git submodules
Next Post
Fixing Async Calls Missing Callbacks