Reputation: 105
I recently started using git on windows 7 and configured everything to access Github, Bitbucket and a private server over ssh.
Now I am switching to Ubuntu OS and I am not sure how to copy the keys and configuration settings over to Ubuntu.
Will you please help me out or point me in the direction of how to do it right ?
Upvotes: 8
Views: 1430
Reputation: 4559
To build upon Hi-Angel's answer:
.git
directory at the root of your repository/project.C:\Users\<user_name>\.gitconfig
.C:\Users\<user_name>\.ssh
(at least, this is the standard)..git
directory at the root of your repository/project (no change and no work here).~/.gitconfig
.~/.ssh
(at least, this is the standard).Copy your .gitconfig
and .ssh
folders from one to the other and you should be good to go.
If you configured some things specific to your OS (such as default editors), you will have to configure those again or reset them after performing the copy, but this cannot be avoided.
You may consider it a hassle, but if one of your computers is a laptop, I would recommend configure separate SSH keys. That way, if your laptop ever gets stolen, you can remove the key and this laptop will never be able to mess with your central repository.
It may not seem that important for codes, but if you use SSH for other purposes (like administering your private server), I think it is crucial to be able to select which computers are allowed to connect.
Upvotes: 6
Reputation: 6682
I think the simplest way is to copy the project folder with .git to your Ubuntu and generate new ssh keys for your new computer.
Follow these links below to generate new ssh keys for your new computer and add to the git service. And then everything is done.
Upvotes: 0
Reputation: 3015
I would recommend to simply copy the ssh public key of your new ubuntu machine into the github account. And the of course, clone the repo again on ubuntu to your favorite local folder
You could use my blog http://balajikatika-technical.blogspot.com/2014/10/setting-up-ssh-keys.html on how to setup ssh keys on a Linux machine. After that you could copy the public key (by default located in /.ssh/id_*.pub file into your github account (Settings->SSH Keys)
Upvotes: 1
Reputation: 5629
Local setting are being stored in the root of you project directory with the name of the dir .git
. But since the project you may probably download from an internet, so the .git
directory appears automagically, I guess you wanted global settings.
The directory of the global settings in Windows® is C:\Users\<user_name>\.gitconfig
. In GNU/Linux it is ~/.gitconfig
, so you may just copy a content there.
Upvotes: 1