How can I make git pull
from [email protected]:...
repository and git push
to [email protected]:...
repository by default?
In Mercurial I create .hg/hgrc
with the following content:
[paths]
default = ssh://[email protected]/...
default-push = ssh://[email protected]/...
What is the way to set the same default behaviour in Git?
It's almost the same in git. Each repository has a .git/config
file and there should be some thing like this in it:
[remote "origin"]
url = git://path/to/your/repo
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
You don't have to add those manually, there's quite a few commands that help you. A good start is the Git SCM Book.
To set the default fore one single branch you can simply type: git branch --set-upstream-to YOUR_REMOTE_NAME/YOUR_BRANCH_NAME
(when using git >= 1.8.0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With