modulaaron
modulaaron

Reputation: 2906

Disable password prompt for git pull, but not for push

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.

Upvotes: 2

Views: 893

Answers (2)

Phil Miller
Phil Miller

Reputation: 38118

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.

Upvotes: 1

VonC
VonC

Reputation: 1323553

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

Upvotes: 3

Related Questions