Git update
Thu, Feb 14, 2019 · 1 minute readlinuxgit
Change Git remote URL
List current remotes:
$ git remote -v
origin ssh://USER@SERVER/bespoke-it-solutions/whatdidilearn.today.git (fetch)
origin ssh://USER@SERVER/bespoke-it-solutions/whatdidilearn.today.git (push)
Change the remote URL to HTTPS:
$ git remote set-url origin https://SERVER/bespoke-it-solutions/whatdidilearn.today.git
List remotes again to confirm change:
$ git remote -v
origin https://SERVER/bespoke-it-solutions/whatdidilearn.today.git (fetch)
origin https://SERVER/bespoke-it-solutions/whatdidilearn.today.git (push)
Fetch from the new URL.
This is private repository so Git prompts for username and password.
$ git fetch
Username for 'https://SERVER': alan@bespoke-it.solutions
Password for 'https://alan@bespoke-it.solutions@SERVER':
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (7/7), done.
From https://SERVER/bespoke-it-solutions/whatdidilearn.today
2377b0c..f8ce333 hugo -> origin/master
Store your HTTPS Git credentials
See documentation for usage and some warnings about doing this.
Notably, credentials are stored on disk unencrypted.
This fine for me as git is running in a private container - YMMV.
$ git config credential.helper store
$ git pull
Username for 'https://SERVER': alan@bespoke-it.solutions
Password for 'https://alan@bespoke-it.solutions@SERVER':
Updating 2377b0c..f8ce333
Fast-forward
...