Wiki
Clone wikiscl-manips-group / install / ssh_access
Generate RSA ID and use ssh with bitbucket
If you do not want to type in your password when using git, you should set up a ssh key to communicate with the git repository. This allows you to securely communicate with the repository while not needing to type after every command your password.
Generate ssh keys
First, you need to generate a ssh -key, open a Terminal (Control+Alt+t) and type in:
ssh-keygen -t rsa -b 4096
The output of this command looks like this:
Generating public/private rsa key pair. Enter file in which to save the key (/home/rkk/.ssh/id_rsa):
You are asked to name a file in which to save your RSA ID, just hint 'Enter' to tell the program to save it to the default folder. The following output will appear:
Created directory '/home/rkk/.ssh'. Enter passphrase (empty for no passphrase):
type a passphrase that will be used to generate the RSA ID
type it once again:
Enter same passphrase again:
The final output looks like this:
Your identification has been saved in /home/rkk/.ssh/id_rsa. Your public key has been saved in /home/rkk/.ssh/id_rsa.pub. The key fingerprint is: .......................................... rkk@Ummy The key's randomart image is: +--[ RSA 4096]----+ |...... | |...... | |...... | |...... | |...... | |...... | |...... | |...... | |...... | +-----------------+
It shows that your private key has been saved in /home/rkk/.ssh/id_rsa
and the public key has been saved to: /home/rkk/.ssh/id_rsa.pub
. You will see your unique looking key fingerprint and key's randomart image.
Display your generated RSA public ID file to see if it worked:
cat ~/.ssh/id_rsa.pub
Copy public key to bitbucket
Copy your key to your clipboard with
xclip -sel clip < ~/.ssh/id_rsa.pub
or on a mac:
pbcopy -sel clip < ~/.ssh/id_rsa.pub
Navigate to the repository site (well, you are already on it...) Now follow these screenshots: Access your personal account by clicking on your name:
Go to the ssh section:
Type in a label name of your choice and copy in your public key:
Save the key.
Change git config files for the ssh access
Navigate back to the start page of the repository, click on SSH to see the appropriate link and copy this link, see also the screenshot below:
Change wiki git config file
Now back to the terminal, navigate to the wiki base folder, to change your config file for the wiki git repository:
cd Documents/scl-manips-wiki.git
Open the wiki git repository config file with gedit
gedit .git/config
In the config file, only change the line url=...
in the section
[remote "origin"]
by copying in the link from the start page of the repository site and add /wiki
behind. The config should now look similar to mine:
}}}
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = git@bitbucket.org:samirmenon/scl-manips-group.git/wiki [branch "master"] remote = origin merge = refs/heads/master
Save it and now test if your changes worked by running the following command:
git pull
The output should be similar to this:
The authenticity of host 'bitbucket.org (207.223.240.181)' can't be established. RSA key fingerprint is ... Are you sure you want to continue connecting (yes/no)?
Now type 'yes'
Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'bitbucket.org,207.223.240.181' (RSA) to the list of known hosts. Already up-to-date.
Now run the git push command
git push
The output should be:
Everything up-to-date
Change actual code repository config file
Now repeat the above steps for your code repository as well: Go to the local folder of the code repository:
cd .. cd scl-manips-group.git
Open the code repository git config file with gedit
gedit .git/config
In the config file, only change the line url=...
in the section
[remote "origin"]
by copying in the link from the start page of the repository site, do not add anything behind it! The config should now look similar to mine:
}}}
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = git@bitbucket.org:samirmenon/scl-manips-group.git [branch "master"] remote = origin merge = refs/heads/master [submodule "3rdparty/sUtil"] url = git://github.com/samirmenon/sUtil.git [branch "robert"] remote = origin merge = refs/heads/robert
Save it and now test if your changes worked by running the following command:
git pull
The output should be similar to this:
The authenticity of host 'bitbucket.org (207.223.240.181)' can't be established. RSA key fingerprint is ... Are you sure you want to continue connecting (yes/no)?
Now type 'yes'
Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'bitbucket.org,207.223.240.181' (RSA) to the list of known hosts. Already up-to-date.
Now run the git push command
git push
The output should be:
Everything up-to-date
Updated