git and GitHub use __ test theory

Source: Internet
Author: User
Tags chmod diff ssh
Install git skip ... git connection github:If you've ever had this problem, I have a solution first, clear all the Key-pair ssh-add-d rm-r ~/.ssh Delete your github in Public-key regenerate the SSH key pair ssh-keygen-t rsa-c "xxx @xxx. com "chmod 0700 ~/.ssh chmod 0600 ~/.ssh/id_rsa* Next normal operation add public key GitHub on Public-key:1, first run Xclip-sel C ~/.ssh/id_r on your terminal Sa.pub copy public key content to clipboard 2, add public key on GitHub, direct copy can be 3, save test: Ssh-t git@github.com success in the terminal, unsuccessful. I have no choice, haha. git operation upload code to GitHub:1. Switch to Superlists path: 2. Execute git init command, create warehouse: git init. #创建仓库You can use/e/superlists as the top-level working directory at this point 3. Ignore some files and do not join the GIT repository: echo "Db.sqlite3" >> gitignore . one point identifies the current directory4. Incorporating files into version control: ( adding files to a folder requires you to use GIT add to incorporate the version librarygit Add. #添加当前目录的文件, . point represents the current directory5. View git Status: git status #查看进展使用这个6. Delete some files from git and add them to Gitignore: git rm-r--cached file path/foldergit rm-r--cached superlists/__pycache__ # R indicates recursion, indicating that all content under the __pycache__ directory will be deleted echo "__pycache__" >> gitignore echo "*.pyc" >>. Gitignore 7. Submit code to GIT warehouse after the Git commit #git commit, the VI edit window opens and the submit message is entered.8. View Status: git status9. Perform the git diff command to see the differences between the last commit and the saved content on the current hard drive: git diff10. Submit code again to git warehouse git commit-a #-a means automatically adding changes in tracked files (that is, submitted files) , no new files are added, new files need to use git add command add these files manually11. Push to GitHub add repository in GitHub; after Git commits, the data has been stored in the local git database. Build a git warehouse in GitHub and let the two warehouses synchronize remotely: first Create New in GitHub Repository, note that the name and path are the same as the local git warehouse(for example, ABC); To run a command associated with a local git warehouse the user name is Liyueliyue GitHub: git remote add Origin git@github.com:liyueliyue/abc.gitTo push data from a local git warehouse to an already associated GitHub account: Git push-u origin master git push is actually pushing the current branch master to the remote, The first push needs to use-u, GIT will not only push the master data of the local GIT warehouse to remote master, but also associate the local master branch with the remote master branch, push or pull to simplify the command at a later time, and from now on the local commit can be the command: git push Origin Master Summary:To associate a remote library, use the command git remote add Origin git@server-name:path/repo-name.git; Master pushes all the contents of the master branch for the first time, and after each local commit, you can use the command GIT push Origin master to push the latest changes whenever necessary;
After adding Readme.txt files to the GitHub new repository, Direct push will cause an error because the local git repository does not have Readme.txt files, the solution is: Code Merge pull = fecth + Merge: git pull--rebase Origin master, you will see the Readme.txt file locally, and then execute GIT push-u Origin master; To Create a branch and merge branchHttps://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/ 001375840038939c291467cc7c747b1810aab2fb8863508000 Create a branch: Git branch dev(branch name); Toggle Branch: git checkout devgit checkout-b dev (checkout plus-B parameter is to create a branch and switch to a new branch) to view the current branch: Git branchSubmit content on New branch: Modify data file, Git commit; push to the dev branch of GitHub: git psuh origin dev , at this time GitHub on the warehouse more than one dev branch, and then choose to manually merge to master;Or: Merge Dev Branch containment into master, then push to master of GitHub: First switch to master:git checkout master; git meger Devmerge the specified branch to the current branch, currently switched to maser; Delete branch: git branch-d Dev

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.