Common git command line operations and problems encountered in pushing to GitHub projects under Linux

Source: Internet
Author: User
I have organized several test projects under GitHub and intend to integrate Python-related Program Put it under Linux for maintenance. So I learned about the GIT command line tool.

Git add# Put files into the local database

Git commit-M "Log message"-# Submit the modification to the local database-A indicates all, or you can choose to submit it with the file name or list.

Git log# View log information git log-N3View the latest 3 logs

Git status# Viewing the local file status

Git Branch# List local branches

Git branch-R# List remote branches

Git branch-# Local remote branches are displayed

Git diff # View File modifications (not used yet)

Git show# More submitted information

Git show 6eb2c1a15a2f52a147cf2d491fdd1d113d218a43# (Submission number) See the content modified in this submission.

 

When we need to submit the local database to the remote server, we need to add a remote point or configure it in. Git/confige.

Git remote addRemote name http://github.com/<username>/<reponame>. Git # Add a remote Branch

Git push origin master push# Push branch to remote

Git remote set-URL# Modify the URL address of the remote branch, for example, the address changed from http to SSH

 

Problems occurred during git push:

Because HTTPS is used for clone, I can only use SSH for push in Linux, so I use git remote set-URL sshurl to change it to an SSH address, or directly go. git/confige

I learned how to establish SSH and GitHub. Reference: https://help.github.com/articles/generating-ssh-keys

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.