Skip to main content

How to synchronize two remote Git repositories

Currently, I have a situation where I have two repositories.  The first is where I've held the code since the beginning.  The second has come on board recently and is the client repo.  However, rather than shut the original down, I want to keep both running with the same code.  How do I synchronise them so that they contain the same thing?

git fatal: The current branch {} has no upstream branch

When attempting to do a git push, are you getting the following response:

fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin main

 

Quick solution, instead run the command

git push origin main

And the response will push what you were attempting to do

Creating then adding a key to the remote repository

In this woalk through I am going to use GitHub.  However, the steps are similar to a Bitbucket profile. 

Logged in to your GitHub account, click your profile icon, located (at the time of this writing) on the top right corner. 

Select Settings

Click SSH and GPG Keys

Click Add New SHH Key

A new page will open  requiring

Applying a patch via Terminal

As a process I apply patches locally first, then using git upload the update(s) to a development site on the server.  Once the testing has been completed, the final step to apply the patch to the production site.  

Using Terminal or your preferred shell program, navigate to the correct directory.  Then run this command using the name of the patch file (example.patch):

Subscribe to GitHub