I want to push the same code from my local using git + vscode to two github repos with only one command without individually specifying each remote.
I have tried adding 2 remote repos in the config file:Updated config file:
cat config[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true[remote "origin"] url = git@github.com:profile1/-MS_E-commerce_Grus_Tep_Online_Full-time_2021_1.git fetch = +refs/heads/*:refs/remotes/origin/*[branch "master"] remote = origin merge = refs/heads/master[remote "github"] fetch = +refs/heads/*:refs/remotes/github/* url = git@github.com:profile2/e-commerceAPI.git pushurl = git@github.com:profile2/e-commerceAPI.git
Now when I do git push
it only pushes to one repo, this one
profile1/-MS_E-commerce_Grus_Tep_Online_Full-time_2021_1.git
I have tried using git push -u github main
but it throws an error:
error: src refspec main does not match any,error: failed to push some refs to 'github.com:profile2/e-comm..
I have tried with git push -u origin main
.But, I'm completely unfamiliar with the process and this is my 1st attempt. Please suggest. I could also go for a way to push it with multiple steps every time as long as my commits are preserved.
Thank You