Reputation: 838
I was happy coding on my laptop, when one day my laptop broke. Luckily, I had saved my work, but not made a commit to bitbucket.
I removed the old hard-drive and bought an enclosure for it. Plugged it into another laptop with git installed, navigated to my local repo via git bash and tried pulling off the updates, that my friend had made. This gave me an authentication error. I tried generating a new ssh key, but this was the same as the old one.
Is it possible, what I tried? Is a cloned repo somehow tied to a certain hardware? How can I get to work?
It would be nice to work this way, as I won't be tied to a machine and I can store my old hard-drive away at night.
Upvotes: 3
Views: 2210
Reputation: 458
I wanted to setup a GIT repo on my local development machine, just using other folder. So I did following:
NOTE!!! that when adding git remote, the remote is WITHOUT .git extension. Just plain folder name.
Upvotes: 0
Reputation: 838
The problem was solved by following the instructions on this page:
Set up SSH for Git and Mercurial on Mac OSX/Linux https://confluence.atlassian.com/pages/viewpage.action?pageId=270827678
The instructions are more comprehensive than other links
Upvotes: 0
Reputation: 382274
The git repository is defined by the .git
folder at the root.
All references inside this .git folder are purely relative, there's nothing tying it to a specific place or hardware, you can move it or copy it without any problem.
The problem you have seems to be uniquely related to ssh authorization, which is managed totally out of git. Fix your ssh problem and ensure you can do basic ssh operations like scp
, then you'll probably be able to use your repo on your new laptop.
Upvotes: 1
Reputation: 1326746
Is what i tried even possible, is a cloned repo somehow tied to a certain hardware
No, a repo isn't tied to an hardware. At all.
If you can clone the BitBucket repo, all you need to do is:
cd /your/local/clone
git status --work-tree=/path/to/your/backup/repo
git add -A --work-tree=/path/to/your/backup/repo
That will detect any changes introduced in the old repo.
Once added, you can commit as normal
git commit -m "restore changes."
Upvotes: 2