GIT submit files to a remote repository

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/mdykj33/article/details/102777312

First, if you are the first to use git, the need for simple configuration

1. Set up your user name and e-mail address

 

$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"

If no, the time for submission of documents in git will complain and remind you configure

$ git commit -m "test"

*** Please tell me who you are.

Run

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

 

2. Check the configuration, you can use the following command to list all the configuration git could find

$ git config --list

Or you can check an item in the git configuration, for example to user.name

$ git config user.name

 

Second, submit links

1. If your project is out of their own new, rather than down the clone from a remote repository, you need to do this step

$ git init

This command creates a named .gitsubdirectory, the subdirectory containing all the files that you must initialize the Git repository.

2. Check the files in git status, check for and clean

$ git status       

3. Tracking already created file

$ git add 1.txt

4. Re-use git status command you can see the files already in the tracking state, we can continue to execute the command

$ git commit -m "test"

The above steps 3 and 4 may be combined into the following order, that is, track skip this step, direct submission

$ git commit -a -m "add 1"

 

But this practice is not common

Note: Now git has not submitted the file to the remote repository, just submitted to the repository.

The push data to a remote repository

$ git push origin master

Here to submit files to a remote git repository is complete -

Guess you like

Origin blog.csdn.net/mdykj33/article/details/102777312