简体   繁体   中英

git push with one username, pull with another

I'm using Git to deploy code onto a server with multiple branches for live and staging setups. I'd like to build a simple web interface for pulling without password, but for security reasons, I'd like to push only from command line with a password secured private key. I have set up two usernames, one of them read-only.

Is there a way to configure the clones repository on the server this way? I've seen the pushurl and remote.url entries in the configuration file, but can't see how I would specify a user for them.

A more robust way of configuring read/write access would be to install on the server side an authorization layer like gitolite .

Then you can setup your 2 usernames in order for one to clone only, the other to push (to the full repo or only to certain branches).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM