How to upload your own code to github

  Steps to upload code to git:

① First register a github account, log in, and create a new repository , click +, click new repository

Get the following page, fill in the warehouse name, write a name by yourself, the following description can be written or not ,

Click Initialize this repository with a README, then create :

②Download git shell. There are many official website download URLs on the Internet. I clicked to download it, but I couldn’t download it.

After I got down, I searched for "git download" on Baidu,

Download can also be used. This is the icon I downloaded:

③Configure Git.


 1. Set the local ssh key, open git bash, and enter the command:

ssh-keygen -t rsa -C "[email protected]" where the double quotes are your note

The email address used when registering on github.

   Keep pressing Enter, select the default path, and empty password. Finally, the .ssh folder will be generated in the default path,

Open .ssh and there are two files in it, open and copy the key inside.


  2. Open github and select settings

Get the following page, click on ssh and gpg keys, and select new ssh key to the right of ssh keys. The content of the green box below appears, fill in the title, and paste the key you just copied into the key. Finally click add ssh key.

3.查看是否成功。在git bash中输入命令:
ssh -T [email protected]
Warning:Permanently added ',' (RSA) to the list of known hosts.
  Hi zhangsiyao11! You've successfully authenticated, but GitHub does not provide shell access.

git clone

此时会在刚才创建ssh  key的默认目录下生成以你仓库名为文件名的文件,打开得到下图所示:


6.在此处打开git bash,输入如下命令:
git init
git add "文件名"  
git commit -m "文件名"

git remote add origin       http为你自己仓库的地址
   fatal: remote origin already exists
git remote rm origin
再执行git remote add origin即可。

git pull origin master
git push origin master



Guess you like