debian多用户下github git push的配置, 不需要帐号密码.
2014-10-06 17:44
363 查看
因为debian有多种用户, root和普通的user
所以我把user作为了私有的git仓库用户. 把root超级管理员作为了github的用户.
这样子只需要单独配置两个不同的共用gitconfig就可以通用了.
第一个是root下的配置, 在/root/.gitconfig
第二个是/home/tom/.gitconfig
这里只说下github在root下的.
一直回车ok,也可以自己换地方保存, username就是你的github的用户名了,yourhost就是你注册的邮箱了.比如我的rainysia@gmail.com
登陆github系统。点击右上角的 Account Settings--->SSH Public keys ---> add another public keys
把你本地生成的密钥复制到里面(key文本框中), 点击 add key 就ok了
接着打开git ,测试连接是否成功
接下来git clone 自己的代码.
克隆完修改, push的时候会提示输入用户名和密码.我们暂停这一操作
在项目目录去修改下,把下面的username换成你的,project_name就是你的github的项目名
或者直接修改项目下.git/config里 [remote "origin"] 的url为 url = git@github.com:username/project_name
这样就可以直接git push了.
所以我把user作为了私有的git仓库用户. 把root超级管理员作为了github的用户.
这样子只需要单独配置两个不同的共用gitconfig就可以通用了.
第一个是root下的配置, 在/root/.gitconfig
[user] name = rainysia email = rainysia@gmail.com [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
第二个是/home/tom/.gitconfig
[user] name = tom xia email = tomx@***.com [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
这里只说下github在root下的.
#cd ~/.ssh #ssh-keygen -t rsa -C "username@yourhost"
一直回车ok,也可以自己换地方保存, username就是你的github的用户名了,yourhost就是你注册的邮箱了.比如我的rainysia@gmail.com
#cat ~/.ssh/id_rsa.pub | ssh username@yourhost `cat >> .ssh/authorized_keys` ssh username@yourhost
登陆github系统。点击右上角的 Account Settings--->SSH Public keys ---> add another public keys
把你本地生成的密钥复制到里面(key文本框中), 点击 add key 就ok了
接着打开git ,测试连接是否成功
#ssh -T git@github.com如果提示:Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access. 说明你连接成功了
接下来git clone 自己的代码.
克隆完修改, push的时候会提示输入用户名和密码.我们暂停这一操作
在项目目录去修改下,把下面的username换成你的,project_name就是你的github的项目名
#git remote set-url origin git@github.com:username/project_name
或者直接修改项目下.git/config里 [remote "origin"] 的url为 url = git@github.com:username/project_name
这样就可以直接git push了.
相关文章推荐
- [Git配置]:git push无需输入帐号密码 如何配置?
- git与github安装、配置、pull、push
- git与github安装、配置、pull、push
- Git push 自动配置用户名、密码
- git快速拉取远程代码,不需要麻烦的配置用户名和密码
- 转Git配置SSH,并Push到GitHub上的相关流程
- Git配置SSH,并Push到GitHub上的相关流程
- mac下git push避免每次都输入用户名和密码的配置
- git每次pull/push到gitHub都要输入密码的解决方案
- Git环境配置&SSH实现免密码Push到本地
- ubuntu samba配置成不需要用户密码访问
- Git 设置不需要用户名、密码直接push的操作
- 配置git push时无需输入用户名和密码
- Git配置SSH,并Push到GitHub上的相关流程
- git学习——设置gitlab、github默认push的用户名和密码
- git push不需要输入密码
- git配置用户名密码、生成ssh。添加到github
- 本地 push 到github 每次都需要输入用户密码问题
- 缓存Github密码,之后git push 不用再输入密码
- Git本地仓库push至GitHub远程仓库每次输入账户密码问题解决