Example git config - MridulS/pysal GitHub Wiki
If you're interested in working across peoples' branches while in development, it becomes important to understand how to pull others' copies of development code to your branch.
To add additional "sidestreams" to your git repository, use
git remote add <name> <url>
If you'd like to protect yourself from pushing to your colleagues' repositories accidentally, you can set your pushurl
to a url that wouldn't resolve correctly:
git remote set-url --push <name> do not push here
This will cause all git push <name>
commands to fail for that . This allows you to pull your colleagues' code down to your local machine without fear that you'll accidentally push your changes onto your colleague's repository.
This change looks very obvious in your ./.git/config
file. An example file could be:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "levi"]
url = [email protected]:ljwolf/pysal.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = levi
merge = refs/heads/master
[remote "upstream"]
url = [email protected]:pysal/pysal.git
fetch = +refs/heads/*:refs/remotes/upstream/*
pushurl = Dont push upstream!
[remote "serge"]
url = [email protected]:sjsrey/pysal.git
fetch = +refs/heads/*:refs/remotes/serge/*
pushurl = Dont push sideways!
[user]
name = ljwolf
email = [email protected]
Then, as an example, to create a branch and fetch a current copy of Serge's network
branch (rather than one from yourself or from upstream) you would simply use:
git checkout -b serge_network
git pull --rebase serge network
This way, you can always be sure to grab current versions of working code while maintaining the same centralized PySAL repo. This has no risk to the organization or to other developers because you've explicitly disabled push rights to all repositories but your own!
git push serge new_network
fatal: 'Dont push sideways!' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.