Skip to content

wgf4413/test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 

Repository files navigation

  • 运行[cmd]打开DOS窗口

  • 切换到下载目录,执行下面克隆命令,从GitHub获取源码

    .\>git clone https://github.com/git/git.git
  • 如果要向git仓库提交内容,需要事先配置用户名和邮件

    .\>git config --global user.name "吴高峰"
    .\>git config --global user.email "wgf4413@163.com"
  • 新建test目录,进入test目录后新建git空库

    .\>mkdir test
    .\>cd test
    .\test\>git init			// 在当前目录下新建git库,执行后出现.git目录(即git库)
    .\test\>touch readme.txt		// 新建立一个文本文件
    .\test\>git add readme.txt		// 把文件纳入git跟踪
    .\test\>git commit -m"new file"		// 把纳入跟踪的文件提交到.git中
  • 建立SSH认证

** 运行[cmd]打开DOS窗口

** 生成SSH私钥和公钥,通过ssh-keygen命令生成类型为rsa密钥,其中id_rsa为密钥文件,id_rsa.pub为公钥

.\>ssh-keygen -t rsa -C "wgf4413@163.com"
Generating public/private rsa key pair
Enter file in which to save the key (/c/Documents and Settings/管理员/.ssh/id_rsa): id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa
Your public key has been saved in id_rsa.pub
They key fingerprint is:
50:b9:68:f3:1f:e0:e9:d2:66:57:9a:56:e8:b3:36:eb wgf4413@163.com

** 在“C:Documents and Settings\管理员”目下自动生成.ssh文件夹,把刚才的私钥文件复制到这个目录

** 需要添加环境变量“HOME”

.\>set HOME=C:\Documents and Settings\管理员

** 然后使用下面验证私钥是否可以和GitHub认证通过

.\>ssh -t git@github.com
Hi wgf4413! you've successfully authenticated, but GitHub does not provide shell access.
  • 把本地的git库提交到GitHub上托管

** 查看当前库配置的远程库地址

.\>git remote -v		//系统默认是origin名称
origin git@github.com:wgf4413/test.git (fetch)
origin git@github.com:wgf4413/test.git (push)

** 把已提交到本地库的内容推送到远程库中

.\>git push origin

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages