If I add remote repository address this way and set it as default:
git init .
remoteName="origin"
dstUrl='location-of-initialized-bare-repository'
git remote add "$remoteName" "$dstUrl"
git config push.default current
touch masterfile
git add masterfile
git commit -m 'first'
git push
git checkout -b feature
touch feautrefile
git add feautrefile
git commit -m 'second'
git push
everything works well. but when i set remote name differently ie:
remoteName="something"
fatal: No configured push destination.
I thought that the name for the remote was arbitrary and could be set to any value without any difference in acting but it seems that for the default remote used for git push
without any parameters it must be origin
or I'm missing someting? Perhaps git looks for origin
by default but in case of different name I need to tell it that the different name is the default?
how to set default remote named differently than origin
?
The solution should work with new branches created in the future.