Upload code to Git remote repository (Github)

1. Register an account on the official website https://github.com/.
2. Create a warehouse in the website and name it code.
3. Upload the local file to the remote warehouse.
[root@localhost ~]# pwd
/root
[root@localhost ~]# echo "# code" >>READE.md
[root@localhost ~]# cat READE.md 
# code
[root@localhost ~]# git init
Initialized empty Git repository in /root/.git/
[root@localhost ~]# git add READE.md
[root@localhost ~]# git commit -m "first commit"
[master (root-commit) 81a76a3] first commit
 1 file changed, 1 insertion(+)
 create mode 100644 READE.md
[root@localhost ~]# git remote add origin https://github.com/cakin24/code.git
[root@localhost ~]# git push -u origin master
Username for 'https://github.com': cakin24
Password for 'https://[email protected]': 
Counting objects: 3, done.
Writing objects: 100% (3/3), 211 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/cakin24/code.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
[root@localhost ~]# vim READE.md 
[root@localhost ~]# git add READE.md
[root@localhost ~]# git commit -m "second commit"
[master f7f5350] second commit
 1 file changed, 1 insertion(+)
[root@localhost ~]# git push -u origin master
Username for 'https://github.com': cakin24
Password for 'https://[email protected]': 
Counting objects: 5, done.
Writing objects: 100% (3/3), 246 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/cakin24/code.git
   81a76a3..f7f5350  master -> master
Branch master set up to track remote branch master from origin.
Four verify whether the upload is successful

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326466643&siteId=291194637