Pushing to a different git repo

You have to add an other remote. Usually, you have an origin remotes, which points to the github (maybe bitbucket) repository you cloned it from. Here’s a few example of what it is:

  • https://github.com/some-user/some-repo (the .git is optional)
  • git@github.com:some-user/some-repo (this is ssh, it allows you to push/pull without having to type your ids every single time)
  • C:/some/folder/on/your/computer Yes! You can push to an other directory on your own computer.

So, when you

$ git push origin master

origin is replaced with it’s value: the url

So, it’s basically just a shortcut. You could type the url yourself each time, it’d do the same!

Note: you can list all your remotes by doing git remote -v.

For your problem

How can I then get different-repo to push remotely to different-repo because currently it is pushing to react.

I’m guessing you want to create a second repository, right? Well, you can create an other remote (or replace the current origin) with the url to this repo!

Add an other remote — recommended

git remote add <remote-name> <url>

So, for example:

$ git remote add different-repo https://github.com/your-username/your-repo

And then, just

$ git push different-repo master

Change the origin remote

git remote set-url <remote-name> <url>

So

git remote set-url origin https://github.com/your-username/your-repo

Leave a Comment

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.