4 ms·
I find it a little confusing, especially when trying to do something a little unusual. For example, I had a git repo on a web host and wanted it moved to anoth
by Claudus 6y ago
I find it a little confusing, especially when trying to do something a little unusual.
For example, I had a git repo on a web host and wanted it moved to another host (they cloned it easily enough), but then I wanted to make the cloned repository "authoritative", but I after several hours of looking for an answer I finally gave up. I was able to clone the new repo to my local machine, but I couldn't push changes to the new repo, and had to log into the new host using the console and commit changes there, which was still looking at the original repository.
- tux1968 6y agoThere is a relatively easy way to accomplish this by editing your .git/config file to point at the new "authoritative" repo. But there is a simpler (although less efficient) method. Just simply git clone the new repository onto any machine you want. The clones will naturally be configured to point to that new repository as their upstream.
- galgalesh 6y agoYou don't need to change config files. `git remote rm origin` `git remote add origin new-url`
- bipson 6y agoThere is a technical difference between an local repo and a remote repo (bare repository) - although I think you can clone from a repo and make this "authoritative", what you usually do is (in your client, not the server) - add a new remote - push your tree to this new remote - remove the old remote (optional) And that's it. You're further not supposed to make commits on a remote directly. Usually this fails hard, for a reason.