github 新增仓库的后的提示
…or create a new repository on the command line
echo "# top" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/liangkeno/top.git
git push -u origin master
…or push an existing repository from the command line
git remote add origin https://github.com/liangkeno/top.git
git push -u origin master
…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.
1,找到安装git的安装目录,C:\Program Files (x86)\Git\bin,win7在计算机属性中添加路径
2,使用命令行添加,set PATH=%PATH%;C:\Program Files (x86)\Git\bin
git 简明教程:http://rogerdudler.github.io/git-guide/index.zh.html
安装git的记录
1,配置git的全局参数,包括用户名,邮箱地址,生产SSH公密钥
1--,命令行设置用户名,邮箱
git config --global user.name "username"
git config --global user.email "username@email.com"
2,push.default参数主要是设置在执行push命令是的策略,主要的选项有以下几个:
nothing : Do not push anything
matching : Push all matching branches (default)
tracking : Push the current branch to whatever it is tracking
current : Push the current branch
这里我们手动设置成默认值:
git config --global push.default matching
3,生成SSH key,在开始菜单中找到git bash并运行
$ssh-keygen -t rsa -C "username@email.com"
此时会提示你输入存储key的文件名(我输入github),并提示你输入密码与确认密码(我这里选择不输入),接着会生成连个文件名一个是公钥与私钥文件并存储在C:\Users\***文件夹下:github,github.pub
config文件,防止链接出现错误,代码如下:
1 Host github.com
2 User git
3 Hostname ssh.github.com
4 PreferredAuthentications publickey
5 >
6 Port 443
4,绑定本机git与github
1--,打开github.pub公钥文件,拷贝里面公钥文本
2--,登陆官网https://github.com/,创建账号,进入设置,在SSH and GPG keys设置公钥,
5,打开git bash,输入ssh git@github.com 测试是否连接上github
显示如下信息即已经连接成功
$ ssh git@github.com
PTY allocation request failed on channel 0
Hi ****! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
5,到此,既可以使用本机上的git连接github上的repository了
使用git Bash 添加文件从本地到github仓库
1,第一次更新到仓库
1--,初始化本地仓库,
git init
2--,更新到版本库
$ git add * //错误提示
warning: LF will be replaced by CRLF in package.json.
The file will have its original line endings in your working directory.
解决方法:
$ git config --global core.autocrlf false
//更新所有文件
$ git add .
//更某个文件
$ git add 文件名
//更某个目录
$ git add 目录名/
此时只是把文件放置缓存区
3--,添加注释
$ git commit -m "相关说明"
4--,关联到远程仓库
$ git remote add origin git@github.com:yourname/yourgit.git
5--,推送到远程仓库
$ git push -u origin master
2,再次更新到仓库,使用 add>>commit>>push origin master 即可
git add .
error: filename too long
git config --global core.longpaths true
3,把远程更新到本地仓库
下载远程到本地 :git fetch origin master
合并远程到本地:git merge origin/master
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com