Git remote provide information to sync with a Git repository to do stuff like git fetch, git push, git pull.
This information is stored in .git/config. In the case of a new directory, that does not have git, start by configuring it with the command git init. Managing remote can be done by the following commands.
Adding a remote
git remote add <name> <url>
Example
git remote add git_user1 user1@git.myserver.local/repo/package.git
git remote add ssh_user1 ssh://user1@10.1.1.100/repo/package.git
View the current remote and detailed remote information
git remote
git remote -v
Remove a remote
git remote remove <name>
git remote rm <name>
Example
git remote rm remote_user1
Push changes of the specific remote
git push <name>
Example
git push ssh_user1
or to push as a new branch
git push -u ssh_user1 new_branch
Show log of the remote
git remote show <name>
Example
git remote show ssh_user1
Show status of CURRENT branch
git status
Change url of an existing remote
git remote set-url <name> <new url>
Example
git remote set-url remote_user1 ssh://user1@10.1.1.23/repo/package.git
No comments:
Post a Comment