Stumbling, complete the code using Git tools to upload

1. Install Git Tools

1) Download and install Git tools: Git Download
the installation is complete, right-click the desktop space, the following options:


2. Initialize the environment

1) In a folder, right click and select the image above Git Bash Here, enter a window interface:

2) Enter the command: git config --global user.name "输入你的Github的账号"
Enter the command again:git config --global user.name "输入你的Github的邮箱"

3) Github account settings SSH key, enter the command: ssh-keygen -t rsa -C 'Github的邮箱'window prompts all choose not to ignore all press Enter
generated files will C:\Users\saibiao\.sshbe found, I was here generates two files, in fact, need three files, the following there will be a solution.
Open the file in id_rsa.pubthe file, copy all

4) Open the GitHub page, suspended on a personal icon, click Settings, find SSH keysand select new SSH Keys, Titlecan be set to the repository name, copy the public key to paste the entire contents of the box, click Add, you will receive e-mail alert

5) associated with the remote repository: Open the needs associated Depot home, copy the SSH link


Run git remote add origin SSH地址 , which origin is from the local warehouse name


3. Start Push file

1) Enter the command window: git initto complete the initialization
2) add a file: touch demo.html
3) add files to the cache library: git add .
4) submission of documents to the repository: git commit -m "备注"
5) to submit files to a remote database:git push -u origin master

6) The fifth step in which the problem may occur if the following situations arise, we enter yes

This step is to generate known_hosts file

也可能出现refusing to merge unrelated histories这个错误,原因是本地仓库是远程仓库不一致,可以先拉取远程仓库到本地,再推送。
解决办法-输入命令:git pull origin master --allow-unrelated-histories,成功拉取之后,再输入命令:git push -u origin master 即可

类似博客推荐

我在实验时,出现了各种各样的问题,最终借鉴其他人的文章才成功,他们写的很好很详细,大家可以去看看。

非常详细的文章:点击查看

非常生动的文章:点击查看

Guess you like

Origin www.cnblogs.com/sixgodbiao/p/12064841.html