git set up remote repository for multi-user SSH no password login problem

Source: Internet
Author: User
Tags commit ssh version control system

Git is currently the world's most advanced distributed version control System (no one).

Distributed version control system differs from centralized version control system

Distributed version control system does not have a "central server", everyone's computer is a full version of the library, so that when you work, you do not need to network, because the repository is on your own computer

If git just manages the file history in a single repository, git and svn are no different. Git is a distributed version control system, and the same git repository can be distributed across different machines.

In the actual use of Distributed version control system, distributed version control system usually also has a "central server" of the computer, but the role of this server is only for the convenience of "exchange" everyone's changes, without it everyone also work, just exchange changes inconvenient. It's definitely a fuss to learn that Git has a server first. The GitHub site is a git repository hosting service, so just sign up for a GitHub account to get a free git remote repository.

Once you've registered your GitHub account, the transfer between your local git repository and your github repository is encrypted via SSH, so you'll need a bit of setup:

1th step: Create SSH Key.

General new users in the Ubuntu/centos and other Linux systems have not set up ssh, that is: The owner of the directory does not have. ssh directory, create ssh Key:

$ ssh-keygen-t rsa-c "youremail@example.com"
Official note-C after "" to fill in your email, personal authentication can actually be any string

Then return all the way, using the default values to

User home directory. SSH directory contains Id_rsa and id_rsa.pub two files, these two are SSH key key pair, Id_rsa is the private key, can not be leaked out, Id_rsa.pub is the public key, you can safely tell anyone.

2nd step: Login to GitHub, open the "settings", "SSH and GPG Keys" page:

Then, click "New SSH Key", fill in any title, paste the contents of the Id_rsa.pub file in the Key text box


After completion can be verified by simple verification below to confirm whether the password can be successfully ssh login to their own github

hadoop@hadoop:.ssh$ ssh-t github.com 
Hi xxxxxx! You've successfully authenticated, but GitHub does not provide shell access.
This can be a good indication of success

3rd Step: Create a new repository in GitHub select name such as Learngit, or your existing repo can also

If the new repository will have hints about how to synchronize with local git

Create a Git repository locally (or a repository that already exists), similar to the following steps

echo "# learngit" >> readme.md
git init
git add readme.md
git commit-m "first commit"
git remote AD D Origin git@github.com:yourgithubid/learngit.git
git push-u Origin Master
And then upload the local readme.md in the repo of your GitHub.

For most Linux users, however, SSH is locally configured, where Id_rsa cannot be overwritten

Can be configured in the following ways

Ssh-keygen-t rsa-c "your_email@youremail.com"
# #更改默认生成/home/hadoop/.ssh/id_rsa name or location such as: Id_rsa_work/Home
/hadoop/.ssh/id_rsa_work
Ssh-add ~/.ssh/id_rsa_work
Create Conf in/home/hadoop/.ssh
#Host是自定义的host简称, you can connect to the remote server later with the command ssh github.com
Host github.com
HostName github.com
User git
Identityfile/home/hadoop/.ssh/id_rsa_work
#第二个git账号, or other use of the
Host Hadoop
HostName Hadoop
User Hadoop
Identityfile/home/hadoop/.ssh/id_rsa

Test Ibid.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.