Tuesday, December 10, 2013

Git: What happens when the remote goes away?

I have found myself working on several different after hours projects over the past few years. There are times when a project lies dormant for quite a while. And when you go back to pick up the pieces for a dormant project you might not remember where everything was/is. In my case, I forgot where the project was actually being hosted. Meaning, was it still on GitHub, or had it been moved over to Bitbucket? Or was it neither place. There had been a migration that had happened over to Bitbucket as they allowed the cost of housing the remote to stay, well... free.

I started looking at my local machine and finally found where I had tucked away the code. But when I tried to ask git where it was pointing to I got an error:

git remote show origin

ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

Ooops, that didn't work out. My curiosity was peaked though. Surely there was a way to get at this information even though the remote might not be there any longer. And there is. You can ask your gitconfig for it:

git config --get remote.origin.url 


This is telling git to get the url of the remote's origin repository out of the local configuration information.

What is duoness you may ask? It stands for "Do Unto Others-ness". It hopes to be a record of people either having done a random act of kindness or having received a random act of kindness. Time will tell if it makes it out to production.

No comments:

Post a Comment