首先下载Git并安装配置好
git config --global user.name "cwolf9"//用户名
git config --global user.email "123456@qq.com"//邮箱
git config --list
ssh-keygen -t ed25519 -C "your_email@example.com"
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
注册
g
i
t
h
u
b
github
github账号,在个人页面点
R
e
p
o
s
i
t
o
r
i
e
s
Repositories
Repositories,再点击绿色的
N
e
w
New
New
新建仓库名称
从gitbash进入你需要创建仓库的文件夹内,输入一下指令
//在这之前,你可以新建任何你想放进去东西
git init
git remote add origin https://github.com/Cwolf9/haha.git
git add . && git commit -m "init"
git push -u origin master
刷新一下仓库页面,就会发现你文件夹里的东西上传上去啦
(o゜▽゜)o☆[BINGO!],仓库创建好啦!!!
当然你也可以直接
c
l
o
n
e
clone
clone一个已经存在的仓库:
git init//初始化本地文件夹
git clone https://github.com/Cwolf9/haha.git//clone一个仓库
git pull//获取更新
git add . && git commit -m "say you want"//记录改变
git push -u origin master//上传
有关 g i t git git更多操作指令请看这里:here
解决私有仓库每次push都要登录验证的问题
用 g i t b a s h git bash gitbash进入你的项目目录,输入:
git config --global credential.helper store
然后它会在你本地生成一个文本,上边记录你的账号和密码。
然后你使用上述的命令配置好之后,再操作一次git push
,这一次它会提示你输入账号密码,之后就不需要再次输入密码了。
删除.git
文件就删除了你本地的git
仓库
合并分支解决不能push问题:here
git添加SSH密钥有啥用