2

Is it possible to prompt for a password when running:

git push -u origin master

but not when running:

git pull origin master

? I would like my developers to be able to keep the dev sites up to date without allowing them to push changes to the origin.

Thanks.

modulaaron
  • 2,856
  • 3
  • 24
  • 28
  • 1
    What transport or transports (git, http, ssh) are you using? – qqx Nov 28 '12 at 17:55
  • @qqx - I'm using the default setup. – modulaaron Nov 29 '12 at 08:00
  • There is no default for the transport used to access remote repositories, that depends entirely on the URL used for the remote. So you haven't answered my question. You could do so by including the output from `git remote -v` in your question. – qqx Nov 29 '12 at 15:25
  • @qqx - origin https://github.com/account/repo.git (fetch); origin https://github.com/account/repo.git (push) – modulaaron Nov 29 '12 at 18:07

2 Answers2

3

You could fork your repo on GitHub and add your devs as collaborator on the fork, asking them for pulling requests if they want to contribute to the original GitHub repo.

They will still be able to fetch from that original repo though (no password needed for a read-only access).

fork

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

If your repository is hosted in a closed network, you could set up anonymous git-daemon or HTTP access to it alongside whatever mechanism you currently use. Then, set the fetch url for the remote to point at the non-authenticated service, while the primary (push) URL for the remote remains authenticated.

Phil Miller
  • 36,389
  • 13
  • 67
  • 90