2.0 KiB
Remotes
git remote -v
Add a remote
git remote add pb https://gitdisroot.org/new_repo.git
Fetching information from remote
git fetch pb git pull
Inspecting remote
git remote show origin
Changing remote url
git remote set-url origin https://repo.multifarm.top/multigranja/bash_tutorial.git
Removing a remote url
git remote rm origin
Addig a remote to a local git repository:
git remote add origin https://git.disroot.org/user/reponame.git
Set the remote as origin
First option:
git push --set-upstream origin master
This command will put "master" as upstream branch. If you have another branch (let's say "main"), the command will create a new branch named "master". After This process you will need to create a pull request and then merge one branch into the other.
git pull origin master --allow-unrelated-histories git merge origin origin/master
Second option:
Set the remote stream (origin
on this example) as main
branch:
should create a branch called "main", then set as "upstream"
git branch --set-upstream-to=origin/main
After this, you can use:
git pull
And the branch "main" would be used as remote.
Optionally you may use the following when you have a new local repository:
git branch -u origin/main
Or use:
git push -u origin main
After this change, you can retrieve and send changes to the remote repository