Coder Social home page Coder Social logo

github's Introduction

Github - git

(一)创建 Github 远程仓库

1.settings 获取 token

(1) 点击头像 settings

(2) 点击 Developer settings

(3) 点击 personal access tokens

图 1

图 2

(4) 生成 token

图 3

该 token 可以使用一段时间,过期后得重新生成


2.git 命令 创建远程仓库

curl -u 'TUTU-Jack:token' https://api.github.com/user/repos -d '{"name":"'Repository name'"}'

(二)创建 Github 本地仓库

SSH密钥配置

git 连接github时可以使用 HTTP 或者 SSH,使用SSH更安全且方便

(1)主机本地生成SSH密钥

ssh-keygen -t rsa -C "[email protected]"
  • 公钥 - id_rsa.pub

  • 私钥 - id_rsa

需要在其它服务器中远程连接本地时,使用公钥,私钥自己保存

(2)打开公钥所在文件,复制公钥

(3)登录 github 设置密钥

图 4

图 5

将复制的公钥复制到 Key 中,创建连接

(4)查看是否连接成功


1.本地配置

git config --global user.name "user name"
git config --global user.email "user emial"

2.将本地文件夹变成本地仓库

# 初始化本地仓库
git init

# 本地仓库连接远程仓库
git remote add <远程仓库地址别名> <远程仓库链接>

git remote add github [email protected]:TUTU-Jack/github.git

# 查看本地连接远程仓库
git remote -v

# 删除远程仓库
git remote rm <远程仓库地址别名>

3.上传本地文件到本地仓库

# 添加文件到缓存区
git add <文件名/文件夹名>

# 添加所有文件到缓存区
git add .

# 将缓存区文件上传到本地仓库
git commit -m "修改描述"

# 撤销上传
git commit --amend

# 查看上传文件修改状态
git status

# 若文件有修改,则需将修改后的文件重新上传

# 查看提交记录
git log

# 查看哪些文件做了什么修改
git diff

4.将本地仓库文件上传到远程仓库

# 将本地仓库上传到远程仓库的某个分支
git push <远程仓库地址别名> <分支名>

5.将远程仓库拉到本地仓库

git pull <远程仓库地址别名> <分支名>

6.创建新分支

# 创建本地仓库新分支
# 切换到某一分支下
git checkout <分支名>

# 在该分支下创建新分支,并切换到该新分支
git checkout -b <分支名>

# 删除本地仓库分支,必须切换到删除分支的上一级
git branch -D <分支名>

# 查看本地分支结构
git branch

# push 本地仓库到远程仓库
git push <远程仓库地址别名> <新建分支名>

# 删除远程仓库分支
git push <远程仓库地址别名> --delete <分支名>

github 上传超过 100M 大文件的方法

https://blog.csdn.net/WANTAWAY314/article/details/115487830

https://www.cnblogs.com/chenlove/p/9778349.html

github's People

Contributors

tutu-jack avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.