git和github使用整理
来源:互联网 发布:amd 知乎 编辑:程序博客网 时间:2024/06/05 11:36
可能出现的错误提示
1、在执行$ git remote addorigin git@github.com:defnngj/hello-world.git
提示错误:fatal: remote origin already exists.
解决办法
$ git remote rm origin
然后在执行:$ git remote add origin git@github.com:defnngj/hello-world.git 就不会报错误了
2、 在执行$ git push origin master
提示错误:error:failed to push som refs to…….
解决办法:
$ git pull origin master // 先把远程服务器github上面的文件拉下来,再push 上去。
3、在.bash_profile配置了adb环境变量后,输入adb命令有效,但是重启iterm窗口就提示command not found
解决办法:
打开.zshrc文件,在最后面添加
# Enable my profilesource ~/.bash_profile
即可
初始创建github项目
获取key
1、进入.ssh目录,查看目录中文件
如果里面有文件,建议清理原ssh密匙
例如:
$ ls config id_rsa id_rsa.pub known_hosts$ mkdir key_backup$ cp id_rsa* key_backup$ rm id_rsa*
2、获取密匙:
ssh-keygen -t rsa -C "liuhuajian_lhj@163.com"//填写email地址,然后一直“回车”ok
生成的id_rsa.pub文件中的内容,就是ssh密匙
3、将生成密匙添加到github中:
登陆github,点击右上角的 Settings—>ssh and GPG keys —> add new public keys即可
测试
测试是否连接成功
$ ssh -T git@github.com
如果提示:Hi defnngj You’ve successfully authenticated, but GitHub does not provide shell access. 说明你连接成功了
配置用户信息
$ git config --global user.name "liuhuajian"//给自己起个用户名$ git config --global user.email "liuhuajian_lhj@163.com" //邮箱
新建一个项目
1、 回到github首页,点击页面右下角“New Repository”
填写项目信息:
project name: hello world
description : my first project
点击“Create Repository”
现在完成了一个项目在github上的创建。
2、我们需要使用git在本地创建一个相同的项目。
$ makdir ~/hello-world //创建一个项目hello-world$ cd ~/hello-world //打开这个项目$ git init //初始化 $ touch README$ git add README //更新README文件$ git commit -m 'first commit'//提交更新,并注释信息“first commit” $ git remote add origin git@github.com:defnngj/hello-world.git //连接远程github项目 $ git push -u origin master //将本地项目更新到github项目上去
- git和github使用整理
- git和github使用整理
- git和github使用
- git和github使用
- git和gitHub使用
- Git和GitHub在线学习资源整理
- Git和GitHub在线学习资源整理
- Git和Github初次使用
- Git 和 Github 初次使用
- Git和Github的使用
- Git 和Github初次使用
- git 和 github 使用 初步
- Git 和Github初次使用
- Git 和Github初次使用
- Git和Github初次使用
- Git和Github初次使用
- 学习使用git和GitHub
- Git和GitHub使用总结
- Linux新手入门:通过chmod改变文件权限
- 一、认识计算机
- PHP实现Unicode和Utf-8编码相互转换
- 使用ajax 实现用户的用户名注册验证,如果该用户已存在则提示该用户已存在
- 170530 逆向-CrackMe(6)
- git和github使用整理
- SVN上传代码
- 南阳理工18题
- 表单实现详细注册信息
- 【PHP编程之路
- css实现水平垂直居中的几种方法
- 依赖注入(DI) 和 控制反转(IoC)
- 【网站开发】搭建一个属入自己的网站
- opencv3_java 图像的阈值图像生成Threshold Imgproc.threshold