git相关命令

2020-06-10  本文已影响0人  鹊南飞_

1. git首次提交

  1. 设置全局参数
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
  1. 上传代码
cd existing_folder
git init
git remote add origin http://localhost/kun/kml.git
git add .
git commit -m "Initial commit"
git push -u origin master

2. git新增gitignore文件

  1. 在项目路径下添加.gitignore文件
touch .gitignore
  1. 编辑文件
vim .gitignore
  1. 如在文件中添加以下内容
*.pyc
  1. 清除已经上传的多余文件
git rm -r --cached 文件夹名
git rm --cached 文件名

3. 解决github加速访问以及图片不能显示的问题

找到host文件,windows的hosts文件位于C:\Windows\System32\drivers\etc\hosts
添加以下内容

# GitHub Start 
192.30.253.112    github.com 
192.30.253.119    gist.github.com
151.101.184.133    assets-cdn.github.com
151.101.184.133    raw.githubusercontent.com
151.101.184.133    gist.githubusercontent.com
151.101.184.133    cloud.githubusercontent.com
151.101.184.133    camo.githubusercontent.com
151.101.184.133    avatars0.githubusercontent.com
151.101.184.133    avatars1.githubusercontent.com
151.101.184.133    avatars2.githubusercontent.com
151.101.184.133    avatars3.githubusercontent.com
151.101.184.133    avatars4.githubusercontent.com
151.101.184.133    avatars5.githubusercontent.com
151.101.184.133    avatars6.githubusercontent.com
151.101.184.133    avatars7.githubusercontent.com
151.101.184.133    avatars8.githubusercontent.com
上一篇 下一篇

猜你喜欢

热点阅读