4

For Github , I transferred my repo to another owner (and was given admin rights to it). Before that I had already cloned it to my desktop using Github Desktop. Now after the transfer, do I need to delete my local files and re-clone it from the new owner? Or can I just use the local files as is and push changes and it would just send it to the new repo location?

omega
  • 40,311
  • 81
  • 251
  • 474
  • You need not re-clone: all Git repositories that are clones of each other share all their commits. Well, *all* means "as of the last time they could", in this case: once ownership changed, perhaps new commits got added over there. But update the remote URL and run `git fetch` and you get the newer commits. – torek Nov 26 '21 at 03:18
  • Note that local *files* are not part of Git at all. They are in your *working tree*, and they may have come *out of* a commit that *is* in Git, but once out, they are just files. Git does not really work with *files*, but rather with *commits*. – torek Nov 26 '21 at 03:18

2 Answers2

1

You could use your current repository and just have to update the 'origin' remote url with the command :

git remote set-url origin https://your-new-repo-url
Philippe
  • 28,207
  • 6
  • 54
  • 78
0

I think you can change the local git remote path (if it doesn't automatically change)

Checking Remote Path on Local:

git remote -v

you will see the output, normally origin one.

If the link isn't right

git remote rm ${remote_name}
git remote rm origin

and to add a new one

git remote add ${remote_name} ${link}
git remote add origin https://github.com/mynew/repo
David Yappeter
  • 1,434
  • 3
  • 15