简体   繁体   中英

How to remove the git remote origin and add new remote origin?

I have cloned the code from one git repo of another person and now I want to commit the code to my git repo. How I can do this without copy-pasting post-checkout separately?

Any git reference would be more helpful.

Run the below commands in sequence:

  • git remote

Will get the current remote path

  • git remote remove <remote path>

So now your remote link will be deleted, now you can add your repo and commit your changes, anyway confirm whether the remote has been deleted using below command

  • git remote

Nothing should be displayed

  • git remote add origin <your git repo http path>

Now your repo will be added as git repo to this folder, so now push your code changes to the new repo using below command.

  • git push origin master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM