git与github

简介: 1、安装git客户端*2、生成密钥$ ssh-keygen -t rsa -C "注册邮箱"然后用户主目录~/.ssh/下有两个文件,id_rsa是私钥,id_rsa.

1、安装git客户端*
2、生成密钥
$ ssh-keygen -t rsa -C "注册邮箱"
然后用户主目录~/.ssh/下有两个文件,id_rsa是私钥,id_rsa.pub是公钥
3、获取key,打开.ssh下的id_rsa.pub文件,里面的内容就是key的内容
$ start ~/.ssh/id_rsa.pub
备注:使用外部工具打开文件
cat ~/.ssh/id_rsa.pub 输出控制台

4、 登录GitHub,打开"SSH Keys"页面,快捷地址:https://github.com/settings/ssh

img_903f3b47968834c4b37a96e38cb6d878.png

5、验证
ssh –T git@github.com
如果是第一次操作,会出现让你输入yes或no,选择yes就行

7、其他配置
git config --global user.name “用户名”
git config --global user.email “邮箱”

8、连接已完成,开始进入本地如何上传到github
9、在github上创建项目,复制url https://github.com/mglue/my-works
10、本地初始化
git init
11、进入暂存状态
git add *.php
12、添加远程github地址
git remote add origin https://github.com/mglue/my-works
13、本地提交给github
git push -u origin master
使用push之前先pull
git pull origin master --allow-unrelated-histories
允许不同项目

目录
相关文章
|
24天前
|
开发工具 git 开发者
掌握版本控制的艺术:Git 与 GitHub 的高效使用指南
在软件开发中,版本控制对于代码管理和团队协作至关重要。本文详细介绍了 Git 的核心概念与命令,包括初始化、创建仓库、文件跟踪、分支管理和远程仓库操作。同时,探讨了如何利用 GitHub 进行项目组织、代码审查及自动化工作流。通过遵循最佳实践,如频繁提交、清晰的信息记录和合理使用分支,开发者可以提升工作效率和团队协作能力,确保项目的持续成功。
|
20天前
|
Shell 网络安全 开发工具
Git,GitHub,Gitee&IDEA集成Git
Git提交项目到GitHub简洁版、版本控制、安装、常用命令、分支、团队协作机制、Github、Gitee远程仓库、IDEA集成Git、IDEA集成Github、IDEA集成Gitee
Git,GitHub,Gitee&IDEA集成Git
|
6天前
|
Shell 网络安全 开发工具
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
|
3月前
|
网络安全 开发工具 git
【git】解决git报错:ssh:connect to host github.com port 22: Connection timed out 亲测有效
【git】解决git报错:ssh:connect to host github.com port 22: Connection timed out 亲测有效
593 1
|
4月前
|
Shell 测试技术 网络安全
【GIT】如何在GitHub上向一个开源项目贡献代码?
【GIT】如何在GitHub上向一个开源项目贡献代码?
51 5
|
4月前
|
开发工具 git
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
66 1
|
3月前
|
网络安全 开发工具 git
使用git克隆仓库报错:Warning: Permanently added‘github.com’ to the .....(ssh )
所以,你可以安全地忽略这个警告,它不会影响到你使用git克隆仓库。如果你已经成功克隆了仓库,那么一切都在正常工作。如果你在克隆过程中遇到其他问题,那可能需要查看具体的错误信息来解决。
52 0
|
4月前
|
开发工具 git
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
229 1
|
4月前
|
开发工具 git
idea中git替换,推送到新的github或者gitlab上面
idea中git替换,推送到新的github或者gitlab上面
315 2
|
4月前
|
Shell 开发工具 git
如何使用git上传代码github仓库
如何使用git上传代码github仓库
下一篇
无影云桌面