Reputation: 155
I want to take a git pull from by shell script, and for that sake I refered to this answer here.
Automating Git pull process on a ec2 ubuntu instances
In this process, I am required to add my ssh key in my github/bitbucket profile and then change the remote repo url from https to ssh, so that I can leverage ssh for taking an git pull. This is supposed to help me taking a git pull from a shell script, and not be prompted for a username/password.
My hiccup here is that, I cannot seem to figure out that after changing the remote url from https to ssh, what will be the implications for other developers on my team, who have not submitted their ssh keys in their profiles.
Will they still be asked username:password, just like old days, or would they have to add their individual ssh keys to their bitbucket profiles?
Any help will be extremely appreciated, thanks!
Upvotes: 1
Views: 979
Reputation: 1
In order to change from http into ssh, you have to follow the below process:
Generate an SSH key pair on your local machine if you haven't already:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
Add your SSH key to the ssh-agent:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
Add the new SSH key to your GitHub account. Copy your SSH key to your clipboard:
cat ~/.ssh/id_rsa.pub
(Go to GitHub -> Settings -> SSH and GPG Keys -> New SSH Key. Then paste your clipboard contents into the "Key" field and save it.)
Change the remote URL from HTTPS to SSH:
git remote set-url origin [email protected]:username/repo.git
Upvotes: 0
Reputation: 977
HTTPS and SSH are just the different protocols to clone/pull/push etc. git repositories. If you change your way of accessing repository from HTTPS to SSH for your user, it won't affect others. They will not even know that you have changed your protocol. Other users will keep getting same Username:password prompt as they are getting currently. Whoever wants to use SSH, need to add their SSH keys same as you did.
Upvotes: 2