一、本地项目执行操作

1.在本地项目目录下初始化git仓库

git init 

2.将本地项目下工作区的所有文件添加到git版本库的暂存区中

git add .

(可以创建.gitignore文件忽略不需要加入到版本库中的文件,或单独git add {filename}将文件加入到版本库)

3.将暂存区的文件进行提交到版本库

git commit -m '{描述}'

 

二、远程github执行操作

1.创建一个和本地项目名同名的仓库

 

三、设置本地项目版本库的远程仓库地址

两种方式:

(1)使用ssh方式:

git remote add origin git@github.com:zqunor/lamp.git

(2)使用http方式:

git remote add origin https://github.com/zqunor/lamp.git

区别是ssh方式当把本地的ssh key公钥放到github上后就可以直接使用push和pull等操作,而http方式需要手动输入github账号的用户名和密码,进行验证

 

四、将本地版本库推送到github上

git push origin master

  

完成同步

 

相关文章:

  • 2021-04-24
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
  • 2021-05-06
  • 2021-07-15
  • 2022-12-23
  • 2021-04-28
猜你喜欢
  • 2022-01-22
  • 2021-09-17
  • 2021-06-05
  • 2021-08-01
  • 2021-07-09
  • 2021-06-07
  • 2021-04-06
相关资源
相似解决方案