首页 > 其他分享 >git推送项目到GitHub

git推送项目到GitHub

时间:2023-03-05 14:57:34浏览次数:33  
标签:git 查看 GitHub ssh 推送 添加

记录一下leetcode上的算法练习,将代码记录下来作为记录,如有错误缺漏请多指点
一、GitHub上创建项目仓库
登录GitHub->new repository

创建库

创建完成后可在your repositories中查看

二、配置git
由于当前使用的系统(Arch)已经安装了git,这里作为回顾

安装git
sudo pacman -S git

配置git账户
git config --global user.name #yourName
git config --global user.email #yourEmail
配置结束后可在~/.gitconfig中查看配置结果

生成SSH密钥
ssh-keygen -t rsa -C #yourEmail
查看SSH密钥
cat ~/.ssh/id_rsa.pub

关联git和GitHub

可使用ssh -T [email protected]查看是否与GitHub建立连接

三、使用git将代码上库
将远端仓库拉取到本地
git clone [email protected]:null-lei/.leetcode.git

添加几个cpp文件进行测试
将修改文件添加至缓存区
git add . #会递归添加当前目录中的所有文件
提交
git commit -m '代码描述'
推送到远端库
git push origin master

在GitHub中查看

标签:git,查看,GitHub,ssh,推送,添加
From: https://www.cnblogs.com/null-lei/p/17178111.html

相关文章