git 远端操作命令
...About 2 min
git远程仓库-github
配置远程仓库-创建SSH Key-检查用户目录
检查用户目录下有没有id_rsa 和 id_rsa.pub,如果没有这两个文件就使用下面的这个命令生成密钥。
ssh-keygen -t rsa –C "youremail@example.com"
在github中设置ssh
登录github,打开settings的SSH and GPG keys,选择New SSH key就可以填充SSH key的相关信息。

填写title,然后将id_rsa.pub里面的密钥复制到Key中,然后点击Add SSH key即可。
选择New Repository(添加仓库)
新建一个目录TestGit,将所有文件复制到TestGit目录下。

然年使用命令创建一个一个本地仓库
git init
git add demo.txt
git add test.txt
git test02.txt
git commit -m "新建文件"

现在把你的目录推送到TestGit远程仓库中
git remote add origin https://github.com/hirCodd/TestGit.git
git push -u origin master

由于远程库是空的,我们第一次推送master分支时,加上了,Git不但会把本地的master分支内容推送的远程新的master分支,还会把本地的master分支和远程的master分支关联起来,在以后的推送或者拉取时就可以简化命令。使用
git push origin master
现在查看远端仓库,如下,已经有相关的文件了。

以后你修改了bug,就可以使用git push origin master推送到github,这样你就拥有分布式版本仓库了。
从远端仓库克隆
使用以下命令:
git clone url
首先现在远端创建一个仓库

使用命令即可从远端clone文件下来

下面会涉及删除与撤销的操作!请继续浏览!
Powered by Waline v2.15.8