If you are using the company username and password, it means that the repo is using a web url. For example
https://github.com/empresa/repositorio.git
And that repository is the origin
. You can check this with
git remote get-url origin
If instead you had cloned the repo using ssh, the previous command would not give you a url but something like
[email protected]:empresa/repositorio.git
Using a remote ssh is more practical because you save the subject of credentials. But to use that method you need a key in your ~/.ssh/
folder and if you're not in linux I do not know how it would be done.
Going back to the original theme. You have a repo that is in
https://github.com/ik2_89/repositorio
Therefore, your web url would be
https://github.com/ik2_89/repositorio.git
To add it you do not have to do it by manually editing the file .git/config
. In fact, edit it back so that it remains as before. To add your repo as an additional remote, which we can call alternativo
. Then you would put him
git remote add alternativo https://github.com/ik2_89/repositorio.git
And then you could push your repo doing, for example
git push alternativo master
In this case you will ask for credentials, and you will enter your own and not the company's.
EDIT: practical exercise.
I will use the https url to clone the repo from Canvg (disclaimer, I am a contributor to that project)
That url is now my origin. I add a second remote pointing to a canvg fork. Always with http:
If I make a change and commit it to force something to differentiate my location from the remote:
Then if I want to push origin
, my company user would enter:
If instead I want to push my remote staff (for example to synchronize, I do it explicitly to myremote
and enter my personal email:
If you use SSH keys you can also, but you have to do a trick so that below your ssh configuration you know which key to use according to the remote.