As a team of developers, we build our projects locally (using git) & and push the code to a private repository specific to that project. For web applications, we connect to the production server via SSH and pull the code in. Our issue is that only one person has permission to do a git pull when an update needs to be pulled to a server.
When a project is added to a server we would generally run the following command:
git clone https://username@bitbucket.org/team-name/test-repository.git
Then when you want to do a git pull
to that repository, you get prompted for your password:
Password for 'username@bitbucket.org':
However, if a different user tries to do a git pull
, they will also be asked for the original users password.
What we would like to do, is authorize our team, or at least some other sort of authorization where we could all do a git pull
without having to ask someone else to log in and do it for each other.
I've tried cloning a git repo without the username:
git clone bitbucket.org:team-name/test-repository.git .
But instead of that working, got this result:
Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '0.0.0.0' to the
list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
We've also found another approach. If I was to log in to do a git pull
, you could use this command:
git remote set-url origin https://username@bitbucket.org/team-name/test-repository.git
This would then allow you to point the repository to your latest commit, and do a git pull from there using your own password, but I still think there must be a better way.
There must be some way where you can simply login and use:
git pull
Password for 'username@bitbucket.org':
Even if someone else has cloned down the repository in the first place?
Try cloning without specifying the username on the url.... and sure, the different users will have to set up their certificates so that magic can happen https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html