Git小结

it2025-01-16  23

注册账号以及创建仓库1.注册账号:https://github.com/2.Create a New Repository,创建一个新的仓库安装git for window 及使用1.安装完成之后,Git Bash 打开git命令行,2.生成ssh key

$ ssh-keygen -t rsa -"youremail.com" 复制代码

youremail.com改为你在github上注册的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行。成功的话会在~/下生成.ssh文件夹,进去打开id_rsa.pub,复制里面的key。回到github上,进入Your Profile(账户配置),左边选择SSH and GPG keys,Add SSH Key,title随便填,粘贴在你电脑上生成的key。3.验证是否成功

$ ssh -T git@github.com  复制代码

如果是第一次的会提示是否continue,输入yes就会看到:You've successfully authenticated, but GitHub does not provide shell access 。这就表示已成功连上 github。 4.设置username和email

$ git config --global user.name "your name" 复制代码 $ git config --global user.email "your_email@youremail.com" 复制代码

5.配置远程地址

git remote add origin git@github.com:github账号/仓库名.git 复制代码

加完之后进入.git,打开config,这里会多出一个remote "origin"内容,这就是刚才添加的远程地址,也可以直接修改config来配置远程地址。 大致流程1.使用git clone https://github.com/xxxxxxx/xxxxx.git克隆到本地2.git pull --rebase origin master 更新3.git add . (将改动添加到暂存区)4.git commit -m "提交说明"5.git push origin master 将本地更改推送到远程master分支。

转载于:https://www.cnblogs.com/Min-Na/p/11050175.html

相关资源:数据结构—成绩单生成器
最新回复(0)