Good news, good news! On January 7, 2019, GitHub launched a new, more open policy for developers, allowing users of the platform to create private repositories for free!!

The GitHub project hosts updates

Github is a hosting platform for both open source and proprietary software projects. We can upload a new project locally to a new repository on Github for hosting, or we can synchronize the project on Github to the local. Local and Github changes can be synchronized to each other. The following describes how to use Github.

Upload local projects to GitHub

  1. CD to the project folder you want to upload and configure Git
$git config --global user.email $git config --global user.emailCopy the code

The citation does not require a password, but provides identification. — Global is the global configuration that will be used by every Git repository on your computer.

  1. Through the commandgit initTurn this folder into a Git-manageable repository
  2. throughgit add -AAdd all files in the project to the staging area inside the cloud.
  3. throughgit commitSubmit the file you just submitted to the staging area to the warehouse.Git commit -m "Add complete project", -m after the text comments, easy to check the historical record to know what is submitted each time.
  4. Log in to or sign up for Github and follow the steps below to create a new repository.

6. After creating the github repository, the github repository is still empty (note, do not add readme. md at this time). Then we associate the local repository with Github and push the content of the local repository to Github repository.

$ git remote add origin https://github.com/{github user name}/{project name}
Copy the code

Replace {github user name} with your Github user name and {project name} with the name of the new repository, which is the Github address of the new repository.

  1. Then push the contents of the local repository to the Github repository with git push. The first git push is followed by the -u option to specify a default host.
$ git push -u origin master
Copy the code

Master branch of local delivery to origin host, specify the origin as the default host at the same time, can not add any parameters after use git push. You will be asked to enter a Github user name and password.

  1. Finally, you can look up the project nian just pushed on Github.

The GitHub repository is synchronized locally

If you make changes to your project on Github, you can follow these steps to synchronize them locally.

  1. Set the current Github repository address.
$git remote add upstream $git remote add upstreamCopy the code
  1. View the address of the current warehouse.
$ git remote -v
Copy the code
  1. Get updates to the Github repository. With fetch updates, the fetch is stored on a local branch, upstream/ Master.
$ git fetch upstream
Copy the code
  1. Merge to local branch. Switch to local master branch and merge upstream/ Master branch.
$ git merge upstream/master
Copy the code
  1. Use git logs to view repository updates.
$ git log
Copy the code

Debug

When I want to synchronize my local repository to Git, run

$ git push -u origin master
Copy the code

Error: Warning: LF will be replaced by CRLF in pom.xml. The file will have its original line endings in your working directory. Git warning: LF will be replaced by CRLF in

git config core.autocrlf false
Copy the code

END