Debian multi-user GitHub git Push configuration, no account password is required.

Source: Internet
Author: User

Because Debian has multiple users: Root and common users

So I used user as a private git repository user and root Super administrator as a GitHub user.

In this way, you only need to configure two different gitconfig instances separately.

The first is the configuration under root, in/root/. gitconfig

[user]    name = rainysia    email = [email protected][alias]    co = checkout    br = branch    ci = commit    st = status    last = log -1 HEAD    cf = config    md = commit --amend    dt = difftool    mt = mergetool    line = log --oneline    latest = for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) [%(committername)]'    ls = log --pretty=format:\"%C(yellow)%h %C(blue)%ad %C(red)%d %C(reset)%s %C(green)[%cn]\" --decorate --date=short    hist = log --pretty=format:\"%C(yellow)%h %C(red)%d %C(reset)%s %C(green)[%an] %C(blue)%ad\" --topo-order --graph --date=short    type = cat-file -t    dump = cat-file -p[color]    diff = auto    status = auto    branch = auto[http]sslverify = true[https]sslverify = true


The second is/home/Tom/. gitconfig.

[user]name = tom xiaemail = [email protected]***.com[alias]co = checkoutbr = branchci = commitst = statuslast = log -1 HEAD    cf = config    md = commit --amend    dt = difftool    mt = mergetool    line = log --oneline    latest = for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) [%(committername)]'    ls = log --pretty=format:\"%C(yellow)%h %C(blue)%ad %C(red)%d %C(reset)%s %C(green)[%cn]\" --decorate --date=short    hist = log --pretty=format:\"%C(yellow)%h %C(red)%d %C(reset)%s %C(green)[%an] %C(blue)%ad\" --topo-order --graph --date=short    type = cat-file -t    dump = cat-file -p[color]diff = autostatus = autobranch = auto


Here we will only talk about GitHub under root.

#cd ~/.ssh#ssh-keygen -t rsa -C "[email protected]"

Always press ENTER OK. You can also save it by yourself. username is your GitHub user name, And yourhost is your registered email address. For example, my [email protected]

#cat ~/.ssh/id_rsa.pub  | ssh [email protected] `cat >> .ssh/authorized_keys`     ssh [email protected]

Log on to the GitHub system. Click account settings ---> SSH public keys ---> Add another public keys

Copy the locally generated key to it (in the key text box) and click Add key.
Start git and test whether the connection is successful.

#ssh -T [email protected]
If the prompt is: Hi XXXX! You 've successfully authenticated, but GitHub does not provide shell access. This indicates that your connection is successful.

Next, run git to clone your code.

After cloning and modification, the user name and password will be prompted during push. We will suspend this operation.

Change the following username to your project directory. project_name is the project name of your GitHub project.

#git remote set-url origin [email protected]:username/project_name

You can also directly change the URL of [remote "Origin"] in. Git/config under the project to url = [email protected]: username/project_name

In this way, you can directly push git.



Debian multi-user GitHub git Push configuration, no account password is required.

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.