Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Adding a Remote Repository in Git

To add a remote repository in Git, you will need to use the 'git remote add' command followed by a

name for the remote and the URL of the repository. The name is typically 'origin' for the primary

remote. Here's how you can do it:

1. Open your terminal.

2. Navigate to the root directory of your local git repository. If you haven't initialized a local git

repository yet, you can do so with:

git init

3. Use the 'git remote add' command to add the new remote repository:

git remote add origin https://github.com/guidopineda/leapp-upgrade.git

In this command, 'origin' is the default name for the remote repository, and

'https://github.com/guidopineda/leapp-upgrade.git' should be replaced with the actual URL of your

remote repository.

4. Verify that the remote has been added by listing all configured remotes:

git remote -v

This command will list all the remotes along with the URLs associated with the fetch and push
operations.

Now that you've added a remote repository, you can push your local commits to it:

git push -u origin master

Remember to replace 'master' with the branch you want to push if you're using a different branch

name like 'main'.

If you encounter any issues, make sure the URL is correct, and you have the necessary permissions

to push to the remote repository. If the repository is empty (newly created), you can also use the '-u'

flag with the 'git push' command to set the upstream (tracking) reference. This tells Git to remember

which remote branch to push to in future commands for the current branch.

You might also like