[{"data":1,"prerenderedAt":6},["ShallowReactive",2],{"\u002F2019\u002F05\u002Fconfigure-multiple-git-credentials-when-using-google-cloud-sdk-for-google-cloud-repositories":3},{"html":4,"toc":5},"\u003Cp>As the long title explains, this is a short code to help out fellow developers who are dipping their toes in git and specifically while using Google Source Repositories.\u003C\u002Fp>\n\u003Cp>I am facing a common scenario where I use Google Cloud Repositories for both office purpose and personal purpose. But I am fairly new to git and when using global credentials the previously configured user doesn't have access to the present repository.\u003C\u002Fp>\n\u003Cp>Here is what I did. I created a new configuration using \u003Cem>gcloud init\u003C\u002Fem>\u003C\u002Fp>\n\u003Cp>The edit the git config with the command\u003C\u002Fp>\n\u003Cp>\u003Cem>git config --edit\u003C\u002Fem>\u003C\u002Fp>\n\u003Cp>Add the following line in the credentials section below helper\u003C\u002Fp>\n\u003Cpre class=\"shiki github-light\" style=\"background-color:#fff;color:#24292e\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan>[credential \"https:\u002F\u002Fsource.developers.google.com\"]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>\thelper = gcloud.cmd\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>\tusername = xxxx@gmail.com\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan>\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Adding the line with username and then using the actual email with respect to your user id of the repository simply works.\u003C\u002Fp>\n\u003Cp>If git gurus out there see this, please suggest whether you can think of a better way for the problem.\u003C\u002Fp>\n",[],1791316327946]