You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the RemoteName you're setting already exists in the local repository, Set method does not overwrite the existing remote url value for you. This means you're not in the desired state even after calling the Set method.
This is because how the resource internally works is by using the command git remote add <RemoteName> <RemoteUrl>
The above command only works if the remote does not exist. If it already exists, then you have to use the command git remote set-url <RemoteName> <RemoteUrl>. The resource should be updated to handle these states.
One approach can be to always try to remove RemoteName before calling git remote add. If the remote ref doesn't exist, git will throw an error which we could ignore and continue with setting the remote through git remote add. That way the command will always set the correct remote. There should be code to save the previous remote in case setting the new one fails so that we don't get the user's repo in a bad state.
Brief description of your issue
If the
RemoteName
you're setting already exists in the local repository,Set
method does not overwrite the existing remote url value for you. This means you're not in the desired state even after calling the Set method.This is because how the resource internally works is by using the command
git remote add <RemoteName> <RemoteUrl>
The above command only works if the remote does not exist. If it already exists, then you have to use the command
git remote set-url <RemoteName> <RemoteUrl>
. The resource should be updated to handle these states.One approach can be to always try to remove
RemoteName
before callinggit remote add
. If the remote ref doesn't exist, git will throw an error which we could ignore and continue with setting the remote throughgit remote add
. That way the command will always set the correct remote. There should be code to save the previous remote in case setting the new one fails so that we don't get the user's repo in a bad state.Steps to reproduce
Run the following
Expected behavior
The remote reference should be updated in the local git repo
Actual behavior
Remote reference isn't updated
Should've been changed to
RemoteUrl
given in the configEnvironment
The text was updated successfully, but these errors were encountered: