为什么80%的码农都做不了架构师?>>>
git 初始化设置
$ git config --global user.name "John Doe"
$ git config --global user.emailjohndoe@
git SSH key
生成SSH密钥过程:
1.查看是否已经有了ssh密钥:cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
2.生存密钥
$ ssh-keygen -t rsa -C "your email address"
按3个回车,密码为空
3.添加密钥到ssh:ssh-add 文件名
需要之前输入密码。
4.在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥。
打开/,登陆你的github账号,然后添加ssh。
5.测试:ssh git@
The authenticity of host ‘ (207.97.227.239)’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to closed.
git clone
法一:不用github的账号,打开这个库在github上的主页,运行下面命令即可
read only
运行命令
$git clone/jenkinsci/gerrit-trigger-plugin.git
下面的三种方法都要先在github上注册账户,然后生成相应的ssh key,并把public key添加到个人账户里面,详见github帮助
read+write
$git clone git@:flyingbird1221/gerrit-trigger-plugin.git
read+write
$git clone https://flyingbird1221@/flyingbird1221/gerrit-trigger-plugin.git
会提示输入密码,注意此处的密码不是你在github上账户的密码,而是当前登录系统用户的密码。
read only
$git clonegit:///flyingbird1221/gerrit-trigger-plugin.git
git 其他常用命令
1.git clone后你的机器上就有一个repo了。
2.git于svn所不同的是git是分布式的,没有服务器概念。所有的人的机器上都有一个repo,每次提交都是给自己机器的repo
仓库初始化:
git init
生成快照并存入项目索引:
git add
文件,还有git rm,git mv等等…
项目索引提交:
git commit
3.协作编程:
将本地repo于远程的origin的repo合并,
推送本地更新到远程:
git push origin master
更新远程更新到本地:
git pull origin master
补充:
添加远端repo:
$ git remote add upstream git:///pjhyett/github-services.git
重命名远端repo:
$ git:///pjhyett/github-services.git为“upstream”
摘录自以下博客:
/feiniao1221/article/details/7516421
/feiniao1221/article/details/7516421