Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move git configuration from Windows to Ubuntu

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 ?

like image 224
user1197736 Avatar asked Jun 05 '15 04:06

user1197736


1 Answers

To build upon Hi-Angel's answer:

Under Windows 7

  • The local Git config is inside the .git directory at the root of your repository/project.
  • The global Git settings are in C:\Users\<user_name>\.gitconfig.
  • The SSH keys you generated are in C:\Users\<user_name>\.ssh (at least, this is the standard).

Under Ubuntu/Linux

  • The local Git config is inside the .git directory at the root of your repository/project (no change and no work here).
  • The global Git settings are in ~/.gitconfig.
  • The SSH keys you generated are in ~/.ssh (at least, this is the standard).

Doing the switch

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.

Just a note about SSH and security

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.

like image 113
Chop Avatar answered Oct 16 '22 23:10

Chop