Git----GitHub uploads local files to git

 

1. First create a library on git to save the uploaded local files

 

2. Turn this directory into a repository that can be managed by git through the command git init

git init

 

3. Clone a copy of the remote git library and save it locally

git clone xxxxxxx
Example: git clone https://github.com/Lucky-Syw/practice.git // See the picture below for this link

 

  After performing this step, you can see that the remote git file has been cloned to the local desktop

  

 

4. Drag the file to be uploaded to the cloned file on the desktop

5. Go to the cloned folder, add the contents of the folder to the repository, use the command git add . to add it to the staging area, don't forget the decimal point "." behind it, which means to add a file all files in the folder

cd /Users/administrator/Desktop/

git add .

 

6. Use the command git commit to tell Git to submit the file to the repository. Commit instructions are in quotation marks

git commit -m "first commit lucky"

 

7. Push the contents of the local library to the remote. Using the git push command actually pushes the current branch master to the remote. After executing this command, you will be asked to enter the user name and password. After the verification is passed, the upload will start.

git push -u origin master

 

8. Use git log to view commit records

git log

 

Finally, the screenshot above to see the specific operation:

 

9. Refresh git again, you can see that the uploaded file has been successful

 

 

Recommend another blog: https://www.cnblogs.com/eedc/p/6168430.html

 

Guess you like

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