Skip to main content

Adding a Remote Repository

Remote repositories will often be Forge repositories. Before adding a remote repository to your local git repository, you need to get the proper remote repository link from your Forge. On Forgejo (https://forge.bearware.dev/ for example), you can find that here:

image.png

Once you have your URL, you can use the remote sub command with it's add option. From there you will need to specify a name (which you use in other commands to specify which remote repository to use), and the URL of the remote repository. For almost all use cases, you will have a single remote repository, and it is traditional to call that remote repository "origin," which I will be using for all related commands. In whole it would look something like this:

git remote add remote-name-here url://example.com/remote/repository

If you are using the suggested name of "origin" it would be:

git remote add origin url://example.com/remote/repository