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.