messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "This repository is configured for Git LFS but 'git-lfs' was not found on your path\n\nPlease help me understand what the below error message means and how to comply with its request.\nI want to copy an existing local git repo; then push that copy to a newly created remote.\nBut I get the following error:\n\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n\nThe code I used immediately prior to getting this message is:\n# create new git repo at https://github.com/username/foo-bar.git\ncp -r OldProject/ NewProject/\ncd NewProject/\ngit remote remove origin # Remove prior origin from copy operation\ngit init\ngit remote add origin https://github.com/username/foo-bar.git\ngit add -A\ngit commit -m \"first commit\"\ngit push -u origin master\n\nWhat am I doing wrong and how can I fix it? Please help me understand what the above error message means and how to comply with its request." }, { "role": "assistant", "content": "This repository is configured for Git LFS but 'git-lfs' was not found on your path\n\nLFS is \"Large File Storage\" an extension for git that keeps large files outside of the actual repository so it doesn't become slow. When the error says \"not found on your path\" it means git was looking for a program that you don't have installed. You can install it using the instructions on https://git-lfs.github.com/.\nA hook, by the way, is a bit of code git runs when you do some action. They are stored in the repository, in the hidden directory .git/hooks." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary chain" }, { "role": "assistant", "content": "A list of objects, where each object in the list contains\na reference to its successor (for example, the successor of a commit could be one of its parents )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Collapsing a git repository's history\nWe have a git project which has quite a big history.\nSpecifically, early in the project there were quite a lot of binary resource files in the project, these have now been removed as they're effectively external resources.\nHowever, the size of our repository is >200MB (the total checkout is currently ~20MB) due to having these files previously committed.\nWhat we'd like to do is \"collapse\" the history so that the repository appears to have been created from a later revision than it was. For example\n1-----2-----3-----4-----+---+---+\n \\ /\n +-----+---+---+\n\n\nRepository created\nLarge set of binary files added\nLarge set of binary files removed\nNew intended 'start' of repository\n\nSo effectively we want to lose the project history before a certain point. At this point there is only one branch, so there's no complication with trying to deal with multiple start points etc. However we don't want to lose all of the history and start a new repository with the current version.\nIs this possible, or are we doomed to have a bloated repository forever?" }, { "role": "assistant", "content": "You can remove the binary bloat and keep the rest of your history. Git allows you to reorder and 'squash' prior commits, so you can combine just the commits that add and remove your big binary files. If the adds were all done in one commit and the removals in another, this will be much easier than dealing with each file.\n$ git log --stat # list all commits and commit messages \n\nSearch this for the commits that add and delete your binary files and note their SHA1s, say 2bcdef and 3cdef3.\nThen to edit the repo's history, use rebase -i command with its interactive option, starting with the parent of the commit where you added your binaries. It will launch your $EDITOR and you'll see a list of commits starting with 2bcdef:\n$ git rebase -i 2bcdef^ # generate a pick list of all commits starting with 2bcdef\n# Rebasing zzzzzz onto yyyyyyy \n# \n# Commands: \n# pick = use commit \n# edit = use commit, but stop for amending \n# squash = use commit, but meld into previous commit \n# \n# If you remove a line here THAT COMMIT WILL BE LOST.\n#\npick 2bcdef Add binary files and other edits\npick xxxxxx Another change\n .\n .\npick 3cdef3 Remove binary files; link to them as external resources\n .\n .\n\nInsert squash 3cdef3 as the second line and remove the line which says pick 3cdef3 from the list. You now have a list of actions for the interactive rebase which will combine the commits which add and delete your binaries into one commit whose diff is just any other changes in those commits. Then it will reapply all of the subsequent commits in order, when you tell it to complete:\n$ git rebase --continue\n\nThis will take a minute or two.\nYou now have a repo that no longer has the binaries coming or going. But they will still take up space because, by default, Git keeps changes around for 30 days before they can be garbage-collected, so that you can change your mind.\nIf you want to remove them now:\n$ git reflog expire --expire=1.minute refs/heads/master\n #all deletions up to 1 minute ago available to be garbage-collected\n$ git fsck --unreachable # lists all the blobs(files) that will be garbage-collected\n$ git prune\n$ git gc \n\nNow you've removed the bloat but kept the rest of your history." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Import existing source code to GitHub\n\nHow can I import source code from my computer to my GitHub account?" }, { "role": "assistant", "content": "If you've got local source code you want to add to a new remote new git repository without 'cloning' the remote first, do the following (I often do this - you create your remote empty repository in bitbucket/github, then push up your source)\n\nCreate the remote repository, and get the URL such as [email protected]:/youruser/somename.git or https://github.com/youruser/somename.git\nIf your local GIT repo is already set up, skips steps 2 and 3\n\nLocally, at the root directory of your source, git init\n2a. If you initialize the repo with a .gitignore and a README.md you should do a git pull {url from step 1} to ensure you don't commit files to source that you want to ignore ;)\nLocally, add and commit what you want in your initial repo (for everything, git add . then git commit -m 'initial commit comment')\n\nto attach your remote repo with the name 'origin' (like cloning would do)\ngit remote add origin [URL From Step 1]\nExecute git pull origin master to pull the remote branch so that they are in sync.\nto push up your master branch (change master to something else for a different branch):\ngit push origin master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to push new (rewritten) history to remote repository\nBasically, I have an open pull request that I want to fix and at the same time I want to make 1 commit that contains 2 features into 2 seperate commits.\nGithub repository now looks like this where fix is a new branch:\nmaster c-c-c\n \\\n fix c-c-c-c\n\nI created a pull request from fix.\nI wanted to change the last commit in fix into 2 commits in my local repository as follows:\nmaster c-c-c\n \\\n fix c-c-c-n-n\n\nwhere n-n are my 2 new commits.\nTo get to this point locally, I did this:\n1. git rebase -i HEAD~2\n2. Changed my last commit line to \"edit\", saved and closed the file\n3. git reset HEAD^\n4. git stash save\n5. Removed the changes I don't want in the first commit\n6. git commit -m \"commit a\" -a\n7. git stash apply\n8. git commit -m \"commit b\"\n\nSo now I have 2 commits the way I want. The problem is I found a bug that ended up in the pull request. Since I have already pushed to the remote repository, it won't accept my new commits (as the original one is now missing).\nI run:\ngit push origin fix --dry-run\n\nand I get the message:\nTo [email protected]:<UserName>/<Repository>.git\n! [rejected] fix -> fix (non-fast-forward)\nerror: failed to push some refs to '[email protected]:<UserName>/<Repository>.git'\n\nI have seen other posts suggest to pull my changes from origin before pushing back again, but won't that basically reset my 2 commits back into the one?\nIdeally, what I would like to do is assign the same commit ID to the last commit so it can replace the current one as is. Is there a way to do that? (Note that I didn't run git reset with --hard)" }, { "role": "assistant", "content": "When faced with that problem, a force push has worked for me:\ngit push --force origin fix\n\nEDIT: Per comments below, --force-with-lease is preferred over a direct --force because it includes some protections in case there has been an intervening commit. This article describes it as \"--force with a seatbelt\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --patch-with-raw" }, { "role": "assistant", "content": "Synonym for -p --raw ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git doesn't ignore 2 specifically named files\nI want to automatically exclude 2 files from committing, that are part of the git repository but have some changes, that shouldn't be part of the github repo, because they have some changes that are only meaningful to my local system and not the other developers.\nI added them to .git/info/exclude in the hopes git understands that he shouldn't commit changes to them:\n# git ls-files --others --exclude-from=.git/info/exclude\n# Lines that start with '#' are comments.\n# For a project mostly in C, the following would be a good set of\n# exclude patterns (uncomment them if you want to use them):\n# *.[oa]\na.conf\nb.conf\n# *~\n\nbut git status still lists them as staged for committing:\n# On branch master\n# Changes to be committed:\n# (use \"git reset HEAD <file>...\" to unstage)\n#\n# modified: build/conf/a.conf\n# modified: build/conf/b.conf\n#\n\nI don't want to unstage them regularly with every commit (one time I might just forget), how can I do that?" }, { "role": "assistant", "content": "What you want to is to ignore changes on tracked files. This cannot achieved (as Charles Bailey says) correctly, neither with .gitignore nor with .git/info/exclude. \nYou'll need to use git update-index:\ngit update-index --assume-unchanged build/conf/a.conf\ngit update-index --assume-unchanged build/conf/b.conf\n\nwill achieve what you want: the files are always assumed unchanged.\nIf you want to track changes in these files again, use --no-assume-unchanged.\nFinally, if you want to know which files are currently in the --assume-unchanged mode, ask git for\ngit ls-files -v | grep -e \"^[hsmrck]\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-shortlog" }, { "role": "assistant", "content": "Summarize git log output" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to write .gitlab-ci.yml job to run only in merge-request\n\nHow to right write job in .gitlab-ci.yml when it run only in merge requests?\ntest_c:\n stage: test\n script:\n - echo \"This job tests something. It will only run when all jobs in the\"\n - echo \"build stage are complete.\"\n only:\n - merge_requests\n\nThis job not run in merge request, but not run and in commint in master or develop." }, { "role": "assistant", "content": "Gitlab documentation recommends using 'rules' instead of 'only'. You can accomplish only merge_requests by doing the following:\ntest_c:\n stage: test\n script:\n - echo \"This job tests something. It will only run when all jobs in the\"\n - echo \"build stage are complete.\"\n rules:\n - if: '$CI_PIPELINE_SOURCE == \"merge_request_event\"'\n\nhttps://docs.gitlab.com/ee/ci/yaml/#workflowrules" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-pull - Fetch from and integrate with another repository or a local branch -f --force" }, { "role": "assistant", "content": "When git fetch is used with <src>:<dst> refspec, it may\nrefuse to update the local branch as discussed\nin the <refspec> part of the git-fetch documentation.\nThis option overrides that check." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: add vs push vs commit\nWhat is the difference between git add, push and commit?\nJust a little confused coming from SVN, where \"update\" will 'add' stuff, and commit does a \"push\" and will 'add' as well\nThere are all different functions within git. Hoping for some explanation from your experience." }, { "role": "assistant", "content": "git add adds your modified files to the queue to be committed later. Files are not committed\n\ngit commit commits the files that have been added and creates a new revision with a log... If you do not add any files, git will not commit anything. You can combine both actions with git commit -a\n\ngit push pushes your changes to the remote repository.\n\n\nThis figure from this git cheat sheet gives a good idea of the work flow\n\ngit add isn't on the figure because the suggested way to commit is the combined git commit -a, but you can mentally add a git add to the change block to understand the flow.\nLastly, the reason why push is a separate command is because of git's philosophy. git is a distributed versioning system, and your local working directory is your repository! All changes you commit are instantly reflected and recorded. push is only used to update the remote repo (which you might share with others) when you're done with whatever it is that you're working on. This is a neat way to work and save changes locally (without network overhead) and update it only when you want to, instead of at every commit. This indirectly results in easier commits/branching etc (why not, right? what does it cost you?) which leads to more save points, without messing with the repository." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "rejected master -> master (non-fast-forward)\nI'm trying to push my project (all files in a new repository). I follow the steps but when I push with git push -u origin master I get this error:\n! [rejected] master -> master (non-fast-forward)\nerror: failed to push some refs to '[email protected]:asantoya/projectnewbies.git'\nTo prevent you from losing history, non-fast-forward updates were rejected\nMerge the remote changes (e.g. 'git pull') before pushing again. See the\n'Note about fast-forwards' section of 'git push --help' for details.\n\nI got this error many times and can't figure out what to do." }, { "role": "assistant", "content": "NOTICE: This is never a recommended use of git. This will overwrite changes on the remote. Only do this if you know 100% that your local changes should be pushed to the remote master.\n⚠️ Try this: git push -f origin master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gitglossary - A Git Glossary plumbing" }, { "role": "assistant", "content": "Cute name for core Git ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Referencing a .css file in github repo as stylesheet in a .html file\n\nI've got a repository on github with a .css file in it. Is there any way to have github serve this file in a way that I can consume it in a web page?\nIn other words, I'd like to be able to reference this source file at github directly, from an HTML file on my local computer or a live domain. Something like:\n<link rel=\"stylesheet\"\n type=\"text/css\"\n href=\"http://github.com/foouser/barproject/master/xenu-is-my-lover.css\"\n/>\n\nI've tried including a<link> to the \"raw\" source file (http://raw.github.com...), but github serves its Content-Type as text/plain, and consequently, Chrome and FF are not adding its content as CSS styles to the page—the file's data is being discarded and a warning is shown in the debugger consoles of the browsers." }, { "role": "assistant", "content": "Important: rawgit.com is shutting down. Read more about other alternatives here - https://rawgit.com/\n\nFound something really cool. You get the raw link as: http://raw.github.com/...\nSimply fetch the files from rawgit.com (or cdn.rawgit.com) instead of raw.github.com and DONE!\n\nUPDATE:\nYou can also use raw.githack.com if you want to serves raw files directly from Bitbucket or GitLab" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc minimal" }, { "role": "assistant", "content": "Spend extra time to make sure the smallest possible diff is\nproduced." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-instaweb - Instantly browse your working repository in gitweb" }, { "role": "assistant", "content": "SYNOPSIS git instaweb [--local] [--httpd=<httpd>] [--port=<port>]\n [--browser=<browser>] git instaweb [--start] [--stop] [--restart]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Effortless export from github wiki (?)\n\nI am collecting quite a lot of material in a GitHub wiki. I really like to use the wiki to cooperate with other people and IMHO the platform is really nice, I like it!\nSo, I would like to keep using the GH wiki to collect stuff, edit, save,etc but I also would like to export the content in order to create a pdf file that we can call \"a manual\".\nI would like to generate an updated version of the manual automatically everytime I want just running a couple of scripts, I can not put too much effort on this.\nI guess it is possible to export the content somehow and the use pandoc (http://johnmacfarlane.net/pandoc/) to create the pdf maybe adding an index and a style file.\nAnother interesting idea could be publish a website once a month dumping content directly from the wiki.\nI guess other people already did something like this but I did not find anynthing. \nAny idea?" }, { "role": "assistant", "content": "But... the Github wiki of a GitHub repo is a git repo in itself (introduced in August 2010).\nYou can clone it, push to it or pull from it.\n\nEach wiki is a Git repository, so you're able to push and pull them like anything else.\nEach wiki respects the same permissions as the source repository.\nJust add \".wiki\" to any repository name in the URL, and you're ready to go.\n\nOr, as noted by htafoya in the comments, replace the .git part of the URL (if present) by .wiki.\nThat makes the \"export\" part of your question really trivial.\nFrom there, you will find tons of script for converting markdown pages into pdf:\n\na graddle task\na makefile\na python script\n..." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options guitool.<name>.argPrompt" }, { "role": "assistant", "content": "Request a string argument from the user, and pass it to the tool\nthrough the ARGS environment variable. Since requesting an\nargument implies confirmation, the confirm option has no effect\nif this is enabled. If the option is set to true , yes , or 1 ,\nthe dialog uses a built-in generic prompt; otherwise the exact\nvalue of the variable is used." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there a Github clone in PHP that I can run on my own server? [closed]\nAs it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.\n \n \n\n\n\nClosed 11 years ago.\n\n\n\nI know there are plenty of ways to run git on my server, but I quite like the functionality of git with repo browsing - the fact that i can look at previous versions in the web interface.\nNow was I able to, I'd use github, but the problem is our source control rules are very strict and we aren't allowed to put files on other servers, even if they are encrypted.\nIs there a script that allows us to run a github like interface, or rather one that allows me to browse the revision history of the git project through a web interface?\nI'm running a LAMP server, but would consider alternate languages like python, perl etc should nothing in php be available.\ninterested in both paid and open source softwares" }, { "role": "assistant", "content": "The webapp behind Gitorious is open-source. You can have an interface exactly like it from your web server. It doesn't have all the Github bells and whistles but it has source browsing, revision history, commits, etc.\nIt's rails, which might not be optimal for you, but it's also free :-)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc -b --ignore-space-change" }, { "role": "assistant", "content": "Ignore changes in amount of whitespace. This ignores whitespace\nat line end, and considers all other sequences of one or\nmore whitespace characters to be equivalent." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to Prevent Garbage Collection in GIT?\nGit mysteriously runs Garbage collection \"from time to time\" and deletes and orphaned commits you have.\nhttps://www.kernel.org/pub/software/scm/git/docs/git-gc.html\nScientifically, this will occur approximately 6-8 hours before you realize you really needed that commit which was just deleted.\nI'd rather not have my files deleted by Git. How can I disable automatic garbage collection altogether?" }, { "role": "assistant", "content": "From the very same page you just linked to:\n\nSome git commands may automatically run git gc; see the --auto flag below for details. If you know what you’re doing and all you want is to disable this behavior permanently without further considerations, just do:\n$ git config --global gc.auto 0" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-merge - Join two or more development histories together merge.renormalize" }, { "role": "assistant", "content": "Tell Git that canonical representation of files in the\nrepository has changed over time (e.g. earlier commits record\ntext files with CRLF line endings, but recent ones use LF line\nendings). In such a repository, Git can convert the data\nrecorded in commits to a canonical form before performing a\nmerge to reduce unnecessary conflicts. For more information,\nsee section \"Merging branches with differing checkin/checkout\nattributes\" in gitattributes ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-commit - Record changes to the repository --dry-run" }, { "role": "assistant", "content": "Do not create a commit, but show a list of paths that are\nto be committed, paths with local changes that will be left\nuncommitted and paths that are untracked." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-difftool - Show changes using common diff tools -y --no-prompt" }, { "role": "assistant", "content": "Do not prompt before launching a diff tool." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --ext-diff" }, { "role": "assistant", "content": "Allow an external diff helper to be executed. If you set an\nexternal diff driver with gitattributes , you need\nto use this option with git-log and friends." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": ".gitignore NuGet exclude packages/ include packages/repositories.config\nI'm trying to create a .gitignore for a Visual Studio project that uses NuGet. It currently contains:\n\\packages/*\n!packages/repositories.config\n\nThis does not ignore anything in the folder. Everything gets staged on an add. I have also tried:\npackages/\n!packages/repositories.config\n\nThis ignores everything in the packages folder and does not include the packages/repositories.config.\nWhat am I doing wrong?" }, { "role": "assistant", "content": "/packages/\n!packages/repositories.config\n\nYou can also add a .gitignore in the packages folder:\n*\n!repositories.config\n!.gitignore" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-grep" }, { "role": "assistant", "content": "Print lines matching a pattern" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Another git process seems to be running and thus cant commit\n\nI was committing my git process and thought that it would be okay if I ignore comments so I used this code\ngit commit filename\n\nBash was strange and thus i closed the console\nnow when I use proper command \ngit commit -m\"THIRD COMMIT\" filename\n\nIt give the following response:\nAnother git process seems to be running in this repository, e.g.\nan editor opened by 'git commit'. Please make sure all processes\nare terminated then try again. If it still fails, a git process\nmay have crashed in this repository earlier:\nwhat should I do?" }, { "role": "assistant", "content": "I met this problem recently too.\nrm -f ./.git/index.lock\n\ntry this commend in your git bash, then you can solve your problem." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Remove buttons from Gitlab interface\n\nIs there a way to remove the buttons for Add Changelog, Add license, Add Contribution guide, Add kubernetes cluster, and set up CI/CD, as well as the banner for Auto DevOps (Beta) from a project page?\nThese are all features that are not necessary for me at the moment and it would be a much cleaner interface without the buttons & banner. There is an image below to show what I mean.\nVersion GitLab 10.6.0-ee" }, { "role": "assistant", "content": "This process worked for me on GitLab 10.8.14 to remove the auto devops message from annoying everyone.\nsudo gitlab-rails console\n\nFeature.get(:auto_devops_banner_disabled).enable => true\n\nexit\n\nsudo gitlab-ctl reconfigure" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip no-renormalize" }, { "role": "assistant", "content": "Disables the renormalize option. This overrides the merge.renormalize configuration variable." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: remove leading plus/minus from lines in diff\nMy question is rather simple, though I have had no luck finding an answer.\nI'd like to remove the leading plus/minus symbols from each line in git diff. Before you ask why I wish to do this, allow me to outline my reasons:\n\nLines that are exactly 80 chars will overflow by a single character, which just looks plain awkward\nThe coloring is enough for me to distinguish between additions/deletions\nI'd prefer to keep my Terminal's window width at 80 chars (as opposed to an arbitrary 81 chars) to maintain consistency with everything else I do in my Terminal (outside of git)\n\nIs there some config option for doing this? If not, how can I do this in a way that still allows me to page through my diff less-style?\nAny insight would be greatly appreciated." }, { "role": "assistant", "content": "The simple way I have seen is this.. Much easy to remember\n(The text format changes. So you need to know the code change)\n\ngit diff --color-words\n\n\nHere is a way to make it default\nIf you are using linux add the following command to your ~/.bashrc file \nThen you can use gitdiff without space as another command .\nalias gitdiff='git diff --color-words'\n\n\n\nUpdate:\nTo set alias directly through git config (Without the help of ~/.bashrc)\nhttps://git-scm.com/book/en/v2/Git-Basics-Git-Aliases \nThank you @dylankb for this.\nExample:\nIf you enter the command git config --global alias.ci commit;\nthen you can use git ci for rest of your life for committing!!\nHappy Gitting :)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab prompts for password while push for git user\n\nI installed gitlab on my servers at linode. All services of gitlab are working fantastic. I am able to login, create users, repos etc.\nBut the problem I am facing is when I try to push a repo it prompts a password for the git user as follows:\n[email protected]'s password\n\nI have followed the instructions of installing gitlab at: https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md and have disable the login got the user git using the following line mentioned in the installation guide:\n\nsudo adduser --disabled-login --gecos 'GitLab' git\n\nI am using gitlab version 6. What could be the problem?\nThe output of: ssh -Tvvv [email protected] is as follows:\nOpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012\ndebug1: Reading configuration data /etc/ssh/ssh_config\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\ndebug2: ssh_connect: needpriv 0\ndebug1: Connecting to gitlab.myserver.com [MY_IP] port 22.\ndebug1: Connection established.\ndebug3: Incorrect RSA1 identifier\ndebug3: Could not load \"/home/swaroop/.ssh/id_rsa\" as a RSA1 public key\ndebug1: identity file /home/swaroop/.ssh/id_rsa type 1\ndebug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048\ndebug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048\ndebug1: identity file /home/swaroop/.ssh/id_rsa-cert type -1\ndebug1: identity file /home/swaroop/.ssh/id_dsa type -1\ndebug1: identity file /home/swaroop/.ssh/id_dsa-cert type -1\ndebug1: identity file /home/swaroop/.ssh/id_ecdsa type -1\ndebug1: identity file /home/swaroop/.ssh/id_ecdsa-cert type -1\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1\ndebug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*\ndebug1: Enabling compatibility mode for protocol 2.0\ndebug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1\ndebug2: fd 3 setting O_NONBLOCK\ndebug3: load_hostkeys: loading entries for host \"gitlab.myserver.com\" from file \"/home/swaroop/.ssh/known_hosts\"\ndebug3: load_hostkeys: found key type ECDSA in file /home/swaroop/.ssh/known_hosts:92\ndebug3: load_hostkeys: loaded 1 keys\ndebug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521\ndebug1: SSH2_MSG_KEXINIT sent\ndebug1: SSH2_MSG_KEXINIT received\ndebug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-rsa,ssh-dss\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: none,[email protected],zlib\ndebug2: kex_parse_kexinit: none,[email protected],zlib\ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: first_kex_follows 0 \ndebug2: kex_parse_kexinit: reserved 0 \ndebug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1\ndebug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: none,[email protected]\ndebug2: kex_parse_kexinit: none,[email protected]\ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: \ndebug2: kex_parse_kexinit: first_kex_follows 0 \ndebug2: kex_parse_kexinit: reserved 0 \ndebug2: mac_setup: found hmac-md5\ndebug1: kex: server->client aes128-ctr hmac-md5 none\ndebug2: mac_setup: found hmac-md5\ndebug1: kex: client->server aes128-ctr hmac-md5 none\ndebug1: sending SSH2_MSG_KEX_ECDH_INIT\ndebug1: expecting SSH2_MSG_KEX_ECDH_REPLY\ndebug1: Server host key: ECDSA 92:57:61:35:b1:e2:16:3b:7f:ae:e7:8a:dc:0c:98:83\ndebug3: load_hostkeys: loading entries for host \"gitlab.myserver.com\" from file \"/home/swaroop/.ssh/known_hosts\"\ndebug3: load_hostkeys: found key type ECDSA in file /home/swaroop/.ssh/known_hosts:92\ndebug3: load_hostkeys: loaded 1 keys\ndebug3: load_hostkeys: loading entries for host \"MY_IP\" from file \"/home/swaroop/.ssh/known_hosts\"\ndebug3: load_hostkeys: found key type ECDSA in file /home/swaroop/.ssh/known_hosts:93\ndebug3: load_hostkeys: loaded 1 keys\ndebug1: Host 'gitlab.myserver.com' is known and matches the ECDSA host key.\ndebug1: Found key in /home/swaroop/.ssh/known_hosts:92\ndebug1: ssh_ecdsa_verify: signature correct\ndebug2: kex_derive_keys\ndebug2: set_newkeys: mode 1\ndebug1: SSH2_MSG_NEWKEYS sent\ndebug1: expecting SSH2_MSG_NEWKEYS\ndebug2: set_newkeys: mode 0\ndebug1: SSH2_MSG_NEWKEYS received\ndebug1: Roaming not allowed by server\ndebug1: SSH2_MSG_SERVICE_REQUEST sent\ndebug2: service_accept: ssh-userauth\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\ndebug2: key: /home/swaroop/.ssh/id_rsa (0x7fd470589410)\ndebug2: key: /home/swaroop/.ssh/id_dsa ((nil))\ndebug2: key: /home/swaroop/.ssh/id_ecdsa ((nil))\ndebug1: Authentications that can continue: publickey,password\ndebug3: start over, passed a different list publickey,password\ndebug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password\ndebug3: authmethod_lookup publickey\ndebug3: remaining preferred: keyboard-interactive,password\ndebug3: authmethod_is_enabled publickey\ndebug1: Next authentication method: publickey\ndebug1: Offering RSA public key: /home/swaroop/.ssh/id_rsa\ndebug3: send_pubkey_test\ndebug2: we sent a publickey packet, wait for reply\ndebug1: Authentications that can continue: publickey,password\ndebug1: Trying private key: /home/swaroop/.ssh/id_dsa\ndebug3: no such identity: /home/swaroop/.ssh/id_dsa\ndebug1: Trying private key: /home/swaroop/.ssh/id_ecdsa\ndebug3: no such identity: /home/swaroop/.ssh/id_ecdsa\ndebug2: we did not send a packet, disable method\ndebug3: authmethod_lookup password\ndebug3: remaining preferred: ,password\ndebug3: authmethod_is_enabled password\ndebug1: Next authentication method: password\n[email protected]'s password: \n\nAlso following is the output when I run: rvmsudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\nSystem information\nSystem: Ubuntu 12.04\nCurrent User: git\nUsing RVM: yes\nRVM Version: 1.22.3\nRuby Version: 2.0.0p247\nGem Version: 2.0.7\nBundler Version:1.3.5\nRake Version: 10.1.0\n\nGitLab information\nVersion: 6.0.0\nRevision: 6c1c284\nDirectory: /home/git/gitlab\nDB Adapter: mysql2\nURL: http://gitlab.myserver.com\nHTTP Clone URL: http://gitlab.myserver.com/some-project.git\nSSH Clone URL: [email protected]:some-project.git\nUsing LDAP: no\nUsing Omniauth: no\n\nGitLab Shell\nVersion: 1.7.0\nRepositories: /home/git/repositories/\nHooks: /home/git/gitlab-shell/hooks/\nGit: /usr/bin/git" }, { "role": "assistant", "content": "I had the same problem but it was because my server only accept ssh login from users of \"sshusers\".\nOn /etc/ssh/sshd_config I had the following line : \nAllowGroups sshusers\n\nIn order to fix this issue, I added git to sshusers group: \n$ sudo adduser git sshusers \n\nAnd then it's working." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git merge from someone else's fork\n\nI have a repository on github, and someone else has forked it and made changes.\nI want to:\n\nCreate a new branch\nMerge their changes into my branch\n\nI have created the new branch:\ngit commit -b my_new_branch\n\nHow do I merge their code into this new branch? \nThis is the branch that I have created: https://github.com/poundifdef/VirginMobileMinutesChecker/tree/widget_toast\nThis is the branch that I want to merge:\nhttps://github.com/xbakesx/VirginMobileMinutesChecker\nWhat is the best way to do this? I've tried a \"pull\" and it won't work. I honestly have no idea what I'm doing in gitland, so if there is a better way to accomplish this (besides my creating a branch and trying to merge) then I am all ears!" }, { "role": "assistant", "content": "Add their github fork repo as a remote to a clone of your own repo:\ngit remote add other-guys-repo <url to other guys repo>\n\nGet their changes:\ngit fetch other-guys-repo\n\nCheckout the branch where you want to merge:\ngit checkout my_new_branch\n\nMerge their changes in (assuming they did their work on the master branch):\ngit merge other-guys-repo/master\n\nResolve conflicts, commit the resolutions and voila." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-submodule - Initialize, update or inspect submodules checkout" }, { "role": "assistant", "content": "the commit recorded in the superproject will be\nchecked out in the submodule on a detached HEAD. If --force is specified, the submodule will be checked out (using git checkout --force ), even if the commit specified\nin the index of the containing repository already matches the commit\nchecked out in the submodule." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git: moving branch head\nI have two git branches, \"A\" and \"B\", and commits numbered 1 thru 8. My history looks like this\n1 -> 2 -> 3 -> 4[A] -> 5 -> 6 -> 7 -> 8[B]\n\nI want to change it so my history looks like this:\n1 -> 2 -> 3 -> 4 -> 5 -> 6[A] -> 7 -> 8[B]\n\nThat is, I want to move the head of branch A from commit 4 to commit 6.\nWhat commands do I use to do this?" }, { "role": "assistant", "content": "You can run:\ngit branch -f A 6" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-tag - Create, list, delete or verify a tag object signed with GPG --contains [<commit>]" }, { "role": "assistant", "content": "Only list tags which contain the specified commit (HEAD if not\nspecified). Implies --list ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab Configuration Issues:: NGINX Unicorn Port Conflict\n\nI have managed to partly setup Gitlab on a Linux CentOS server with Apache, Git, PHP, PostGreSQL and MySQL. I am running the Chef Cookbook version. I got the rpm from here. I wanted to use it to manage my Git repo better and more visually and this seemed to be a good choice. But now I run into issues getting it to work.\nJust to make it really work and update all files I decided to rerun the configuration using gitlab-ctl reconfigure. Second run did work:\nChef Client finished, 4 resources updated\ngitlab Reconfigured!\n\nSee full log\nThe hoster had already put NGINX on 8080 not get into an argument with Apache running on port 80 where we have a LAMP project running. But now Ruby's Unicorn Web Server seems to be conflicting with NGINX. I have worked with NGINX a little bit, not much and this is my first stab at Gitlab. Anyways this is what I figured out with the help of my hoster.\nWhen I log into testserver.domain.net and pass the following command:\nnetstat -ln |grep 8080 I see\ntcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN \n\nSo something is running on 8080\nAccording to my hoster it should run on 0.0.0.0:8080. And when we check what is running on that port we see\nnetstat -tupln |grep 8080\ntcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 21627/unicorn maste \n\nWhen we check the process id 21627, we see\ncat /proc/21627/cmdline \nunicorn master -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru\n\nThat is a Ruby process, and not a NGINX process.\nSo NGINX seems to be conflicting with Unicorn.\nAnd when we check the logs of nginx we see that nginx cannot get going because of this:\ntail -f /var/log/gitlab/nginx/error.log \n2014/07/28 09:43:10 [emerg] 23122#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)\n2014/07/28 09:43:10 [emerg] 23122#0: still could not bind()\n2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)\n2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)\n2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)\n2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)\n2014/07/28 09:43:12 [emerg] 23123#0: bind() to 0.0.0.0:8080 failed (98: Address already in use)\n2014/07/28 09:43:12 [emerg] 23123#0: still could not bind()\n\nI googled Unicorn.rb and found this link. I also read that:\n\nUnicorn is an HTTP server for Rack applications designed to only serve\n fast clients on low-latency, high-bandwidth connections and take\n advantage of features in Unix/Unix-like kernels. Slow clients should\n only be served by placing a reverse proxy capable of fully buffering\n both the the request and response in between Unicorn and slow clients.\n\nWhen I check the file /var/opt/gitlab/gitlab-rails/etc/unicorn.rb I do see it uses 8080. Issue is that it seems Unicorn should work together with NGINX so perhaps I should not change the port. \nWhat step should I take to make Gitlab work? Can Gitlab work without Unicorn? I would think not. Should I then pick another port for it or perhaps for NGINX?" }, { "role": "assistant", "content": "You should override the ports in /etc/gitlab/gitlab.rb. Don't mess with /var/opt/gitlab/... because any manual configuration will be lost after a reconfigure. In particular read on Setting the NGINX listen port. In the downloads page there is a sentence: For troubleshooting and configuration options please see the Omnibus GitLab readme. I wonder if this is not seen by people :/ If not we should make it more clear." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --src-prefix=<prefix>" }, { "role": "assistant", "content": "Show the given source prefix instead of \"a/\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-bundle - Move objects and refs by archive --progress" }, { "role": "assistant", "content": "Progress status is reported on the standard error stream\nby default when it is attached to a terminal, unless -q\nis specified. This flag forces progress status even if\nthe standard error stream is not directed to a terminal." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I get last commit from GitHub API\n\nWhich is the best way to get the latest commit information from a git repository using GitHub API (Rest API v3).\nOption 1: GET /repos/:owner/:repo/commits/master\nCan I assume that the object 'commit' of the response is the latest commit from branch master?\nOption 2: GET /repos/:owner/:repo/git/commits/5a2ff\nOr make two calls, one to get the sha by getting the HEAD ref from master and then get the commit information using the sha returned." }, { "role": "assistant", "content": "It depends on your definition of \"last\".\n\nfor a given branch (like master), GET /repos/:owner/:repo/commits/master is indeed the last (most recent) commit.\nBut you can also consider the last push event: that would represent the last and most recent commit done (on any branch), pushed by a user to this repo." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the git equivalent of of hg outgoing (hg out) or hg incoming (hg in)? [duplicate]\nThis question already has answers here:\n \n \n\n\n\nClosed 12 years ago.\n\n\n\n\nPossible Duplicate:\nHow can I see incoming commits in git? \n\nWhat is the git equivalent of of \"hg outgoing\" or \"hg incoming\"?\nIn Mercurial, hg outgoing lists the changesets that are newer than what's on the server and will be sent if I were to do hg push. Same in reverse for hg incoming and hg pull." }, { "role": "assistant", "content": "If you want to list commits that are on branch B but not on branch A, do git log A..B.\nIf you want to list commits that are on your local branch dev, but not the the remote branch origin/dev, do:\ngit fetch origin # Update origin/dev if needed\ngit log origin/dev..dev\n\nIf you want to list commits that are on the remote branch, but not on the local branch, simply do the converse:\ngit fetch origin # Update origin/dev if needed\ngit log dev..origin/dev\n\nNote: you might find it easier to compare branches graphically using gitk origin origin/dev" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to add icon to my repository?\n\nI have found that Gitlab and SourceTree support icons for every repositories which make them more specific and easy to find at one glance.\nHow is this possible?" }, { "role": "assistant", "content": "We as a developer sometimes need a change to make our tools look different.\nYou can add a small(I prefer 96px x 96px) logo.png image file to the root of your repository.\n\nWhich makes your project more specific and easy to find with gitlab or SourceTree git client. Unfortunately github does not support this feature.\n\nIt is very simple but it works!\n\nUpdate: Thanks to your comments I have found another way within Gitlab repository settings:\n\nhope you enjoy this trick and make your tools more fun :)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects -W --function-context" }, { "role": "assistant", "content": "Show whole function as context lines for each change.\nThe function names are determined in the same way as git diff works out patch hunk headers (see Defining a\ncustom hunk-header in gitattributes )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index -z" }, { "role": "assistant", "content": "When --numstat has been given, do not munge pathnames,\nbut use a NUL-terminated machine-readable format. Without this option, pathnames with \"unusual\" characters are quoted as\nexplained for the configuration variable core.quotePath (see git-config )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-read-tree - Reads tree information into the index" }, { "role": "assistant", "content": "SYNOPSIS git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>)\n\t\t[-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n\t\t(--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --word-diff-regex=<regex>" }, { "role": "assistant", "content": "Use <regex> to decide what a word is, instead of considering\nruns of non-whitespace to be a word. Also implies --word-diff unless it was already enabled. Every non-overlapping match of the\n<regex> is considered a word. Anything between these matches is\nconsidered whitespace and ignored(!) for the purposes of finding\ndifferences. You may want to append |[^[:space:]] to your regular\nexpression to make sure that it matches all non-whitespace characters.\nA match that contains a newline is silently truncated(!) at the\nnewline. For example, --word-diff-regex=. will treat each character as a word\nand, correspondingly, show differences character by character. The regex can also be set via a diff driver or configuration option, see gitattributes or git-config . Giving it explicitly\noverrides any diff driver or configuration setting. Diff drivers\noverride configuration settings." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git commit error: pathspec 'commit' did not match any file(s) known to git\nI am trying to upload a Ruby app to Heroku. I start with git init and then I type git add . and then I use git commit -m initial commit. \nWhenever I use git commit -m, I receive an error message saying:\n\ngit commit error:pathspect 'commit' did not match any file(s) known to git. \n\nI have been told that this is happening because the arguments are in the wrong order. \nThe thing I noticed is that when I use git add . it will not list the files that are being added because it will just go to the next line. \nI suspect that I am having this problem because my files are not really being added.\nI would appreciate any advice about how to correct this problem." }, { "role": "assistant", "content": "The command line arguments are separated by space. If you want provide an argument with a space in it, you should quote it. So use git commit -m \"initial commit\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc zebra" }, { "role": "assistant", "content": "Blocks of moved text are detected as in blocks mode. The blocks\nare painted using either the color.diff.{old,new}Moved color or color.diff.{old,new}MovedAlternative . The change between\nthe two colors indicates that a new block was detected." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitHub Clone with OAuth Access Token\n\nInside a script I am trying to clone a GitHub repository with an OAuth token.\nAccording to this tutorial:\nhttps://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth\nI should be able to build a command for it like this:\ngit clone https://<token>@github.com/owner/repo.git\n\nIf I try this manually with a proper access token, it still asks for my password.\nIf I try it on the commandline I am simply getting a repository not found error.\nThe article is from 2012 and I cannot find any API documentation for this. So I am wondering if this still works." }, { "role": "assistant", "content": "Just use the HTTPS address to clone with the key as the user, so:\ngit clone https://oauth2:[email protected]/username/repo.git\n\nor\ngit clone https://username:[email protected]/username/repo.git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-merge-base - Find as good common ancestors as possible for a merge" }, { "role": "assistant", "content": "SYNOPSIS git merge-base [-a | --all] <commit> <commit>…​ git merge-base [-a | --all] --octopus <commit>…​ git merge-base --is-ancestor <commit> <commit> git merge-base --independent <commit>…​ git merge-base --fork-point <ref> [<commit>]" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-apply - Apply a patch to files and/or to the index --apply" }, { "role": "assistant", "content": "If you use any of the options marked \"Turns off apply \" above, git apply reads and outputs the\nrequested information without actually applying the\npatch. Give this flag after those flags to also apply\nthe patch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern --cached" }, { "role": "assistant", "content": "Instead of searching tracked files in the working tree, search\nblobs registered in the index file." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to diagnose and fix git fatal: unable to read tree\nI'm using git to manage files on a project, and keep running into this problem.\nWhen I run git status I get the message\nfatal: unable to read tree e2d920161d41631066945a3cbcd1b043de919570\n\nAs I understand it, I should check the output of git fsck, and I receive\nbroken link from tree e09a42f248afff64336fbbec2523df97c26451ac\n to tree e2d920161d41631066945a3cbcd1b043de919570\nbroken link from tree e09a42f248afff64336fbbec2523df97c26451ac\n to tree 9b0dd389bd7f9e8d257395d57e0881b7957f9698\nbroken link from tree e09a42f248afff64336fbbec2523df97c26451ac\n to tree 9e288a4ad60d63f342dfd18237980674426aa725\nbroken link from tree e09a42f248afff64336fbbec2523df97c26451ac\n to tree 2a04647337089f554fab8c49cfd37149e5f4fc9f\nbroken link from tree e09a42f248afff64336fbbec2523df97c26451ac\n to tree ea16658b45ce961adc3c3f519b0e8d9672918ca8\n\ntogether with a lot of missing blob messages.\nFollowing various resources (e.g Git - Broken Links, Missing & Dangling Trees) I have simply re-cloned the project from github and started again. \nOnce I have re-cloned the project, all is good for a few commits, and then the problem arises again. Re-cloning every time doesn't seem to be optimal, and seems to go against the idea of using git, and I'd like to try and understand what is going on. How can I diagnose and fix this problem?" }, { "role": "assistant", "content": "Following my older recommendation, it boils down to being able to find a repo which actually contains the missing elements (here full trees).\nThis is what is shown in \"How to fix corrupted git repository?\".\nBut if a full clone doesn't solve the problem, then it may be:\n\na corruption of the repo on the GitHub side (contact GitHub support to check).\nsome kind of corruption on the client side (your Ubuntu). Make sure to check if the issue persists with the latest Git release (1.8.5.2-1) from a custom PPA (Personal Package Archive).\n\n\nUpdate July 2016, with Git 2.10 soon to be release, you now have:\ngit fsck --name-objects\n\nSee \"How to fix git error broken link from tree to tree?\" for more." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Pushing tags with Jenkins Git Publisher - multiple Git repositories (forks)\n\nOur team is transitioning from CVS to Git. We intend to use the similar workflow as most open source projects on GitHub - each developer takes a fork of the main repo and then submits a pull request which will allow the project master to do a code review before merging the changes into the main repo.\nJenkins allows us to add multiple Git repositories (the standard Git plugin, not the Multiple SCM one). Presumably I can enter the URL for each forked repo and then Jenkins will check all branches each fork for changes. I give each repository a name eg \"master\", \"developer1\", \"developer2\"...\nWe want to have Jenkins tagging each build on the appropriate remote/fork. The Git Publisher plugin requires that you provide the \"target remote name\", but we need Jenkins to be able to figure this out for itself." }, { "role": "assistant", "content": "I've managed to solve this one myself. \n\nAt the top of the Jenkins project config page check \"This build is parameterized\" and add a string parameter \"remote\" with default \"master\".\nAdd \"Git Publisher\" as a Post-build action, and a Tag \"$BUILD_TAG\" and Target remote name = \"$remote\"\nIn Build Triggers, check \"Trigger builds remotely\"\nWe're using GitLab and under the project Settings menu I add a \"Web Hook\":\nhttp://my-jenkins-server.com/job/my-project/buildWithParameters?token=secret&remote=master\n\nAdd a web hook for each fork, and make sure that the \"remote\" parameter matches the repository name configured in Jenkins." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to make GIT ignore my changes\nAlthough the title seems similar to previous questions, I could not find the solution to to my Simple case:\n\nI committed to my branch 'ABCD' : git commit -a .....\nThen decided to visit a previous commit so : git checkout 2387687326487\nHere I made some changes which was for testing purpose only, and I don't want to keep them\nI am done, I want to get back to my latest commit(again:ignoring changes whcih i made to the old commit) : the command git checkout 'ABCD' gives error:\n\n\nYour local changes to the following files will be overwritten by checkout....please commit or stash...\n\nwhile I don't want to commit or stash or whatever. I just want to go back home :) what should I do please?" }, { "role": "assistant", "content": "Using just\ngit checkout .\n\nwill discard any uncommitted changes in the current directory (the dot means current directory).\nEDIT in response to @GokulNK:\nIf you want to keep those changes for future use, you have 2 options:\n\ngit stash: this will save those changes in a stack. You can apply the changes to your working copy later using git stash pop\ngit diff > changes.patch: This will save those changes to the file changes.patch. If you want to apply them to your working copy you can do so: git apply changes.patch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Adding a collaborator to my free GitHub account?\nI created a GitHub account, and I want to give someone write access so he can push just like me, there is a way to add a collaborator with a free plan? If not, what can I do? (besides buying a paid account, which I'll do in the future)" }, { "role": "assistant", "content": "Go to Manage Access page under settings (https://github.com/user/repo/settings/access) and add the collaborators as needed.\nScreenshot:" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Best way to integrate Git with Ant?\nI am looking for the best way to integrate Git with Ant. Is there a widely used Ant task for Git? Does anyone have any experience using Git through Ant (e.g. dedicated task, exec call, etc)?" }, { "role": "assistant", "content": "Ant supports the exec command that you can use to pass any command (including Git) to the command line for execution. You can always fall back on that." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git Clone Into Another Existing Git Repo\nAm I going to run into any issues if I git clone a repo into an existing git repo? \nFor sake of simplification, I am developing a library \"lib/\" that should be available to all of my projects. This is a separate git repo. I'd like to import this lib/ into all of my projects, and update it only in one place, never touch it from any of the projects, just use it. \nI am assuming this is ok, just wondered if there is anything I should watch out for. Thanks!" }, { "role": "assistant", "content": "Just for the record, you can clone a git repo within another one:\nEverything under your lib directory will be ignored by the enclosing Git repo, because said lib directory contains a .git.\nSo it would work, but the enclosing repo would have no idea:\n\nit needs a lib directory from another repo\nit needs a specific revision of that lib to build properly, even though it would record the SHA1 of the nested lib repo tree. (that is a gitlink, a special entry in the index of the parent repo)\nThat means cloning the enclosing repo, and you will get an empty \"lib/\" folder.\n\nThose (repo URL and repo SHA1) are precisely the two informations recorded by the parent repo (the enclosing one) in order to reference a submodule.\nIt is made to give you access to a fixed revision of another repo within your repo, but as explained in \"True nature of submodules\", that doesn't prevent you to locally modify lib directly within your parent repo.\n(As long as you commit your modifications in lib first, then go one level up back in your parent repo, and commit there as well)\nThe main benefit to any contributor of your main project is that, when they will clone said project, they will know they also need lib if it is declared as a submodule (as mentioned in \"Git Submodule Workflow Advice\")." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options --get-color <name> [<default>]" }, { "role": "assistant", "content": "Find the color configured for name (e.g. color.diff.new ) and\noutput it as the ANSI color escape sequence to the standard\noutput. The optional default parameter is used instead, if\nthere is no color configured for name . --type=color [--default=<default>] is preferred over --get-color (but note that --get-color will omit the trailing newline printed by --type=color )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-show - Show various types of objects plain" }, { "role": "assistant", "content": "Any line that is added in one location and was removed\nin another location will be colored with color.diff.newMoved .\nSimilarly color.diff.oldMoved will be used for removed lines\nthat are added somewhere else in the diff. This mode picks up any\nmoved line, but it is not very useful in a review to determine\nif a block of code was moved without permutation." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to backup/export Gitlab CI environment variables?\n\nWe have a continuously growing collection of Gitlab CI variables (around 40-50) in our current project. All these variables are used during our CI/CD pipeline and are crucial for our production environment.\nI want to generate backups in regular intervals in case someone messes with these variables.\nUnfortunately, I do not see any options to export the variables in Project -> Settings -> CI / CD -> Environment variables. All I can do is viewing / editing / deleting the variables. \nIs there maybe a hidden export function for these variables? We are self-hosting our Gitlab instance (GitLab Community Edition 11.8.1)." }, { "role": "assistant", "content": "You can use the API in order to query all variables. For example:\ncurl --header \"PRIVATE-TOKEN: <your_access_token>\" \"https://gitlab.example.com/api/v4/projects/1/variables/TEST_VARIABLE_1\"\n\nSee: https://docs.gitlab.com/ce/api/project_level_variables.html#show-variable-details" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Clone A Private Repository (Github)\nI have a private repository on Github for a project I'm working on. Until now I had only worked on my home desktop, but I just bought a laptop, and am trying to set it up so that I can work on the project from either computer, and push / pull changes.\nI added a new SSH key to my Github account for the laptop, and was successful in cloning and making changes to a public test repo that I set up. However, I couldn't clone the private repo. Is there anything special I need to do in the command line in order to clone a private repo? Do I need to set up a new GitHub account for my laptop and set myself up as a collaborator?\nThe command I used was git clone git://github.com/username/reponame.git" }, { "role": "assistant", "content": "Apr, 2022 Update:\nYou can clone a private repository from your account and you can also clone a private repository from organization if you're its owner or member.\n*pat is PAT(Personal Access Token).\ngit clone https://<pat>@github.com/<your account or organization>/<repo>.git\n\nTo clone a private repository from your account or organization, you need to generate a PAT(Personal Access Token) on your Github account, and add it to the command above. *Organization doesn't have PAT generator.\nThis is how you generate a PAT on your Github account:\n1, Go to \"Settings\":\n\n2, Scroll down then go to \"Developer settings\":\n\n3, Press \"Personal access tokens\" then press \"Generate new token\":\n\n4, Fill \"Note\" then check \"repo\":\n*If \"repo\" is not checked, you cannot clone a private repository.\n\n5, Scroll down then press \"Generate token\":\n\n6, Finally, a PAT is generated:\n\nThis is the command with the PAT generated above:\ngit clone https://[email protected]/<your account or organization>/<repo>.git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --show-notes[=<ref>] --[no-]standard-notes" }, { "role": "assistant", "content": "These options are deprecated. Use the above --notes/--no-notes\noptions instead." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff-index - Compare a tree to the working tree or index --stat[=<width>[,<name-width>[,<count>]]]" }, { "role": "assistant", "content": "Generate a diffstat. By default, as much space as necessary\nwill be used for the filename part, and the rest for the graph\npart. Maximum width defaults to terminal width, or 80 columns\nif not connected to a terminal, and can be overridden by <width> . The width of the filename part can be limited by\ngiving another width <name-width> after a comma or by setting diff.statNameWidth=<width> . The width of the graph part can be\nlimited by using --stat-graph-width=<width> or by setting diff.statGraphWidth=<width> . Using --stat or --stat-graph-width affects all commands generating a stat graph,\nwhile setting diff.statNameWidth or diff.statGraphWidth does not affect git format-patch .\nBy giving a third parameter <count> , you can limit the output to\nthe first <count> lines, followed by ... if there are more. These parameters can also be set individually with --stat-width=<width> , --stat-name-width=<name-width> and --stat-count=<count> ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git diff --name-status : What does R100 mean?\nWhen I do e.g. git diff master --name-status I see some lines with the R100 prefix on them. \nWhat does R100 exactly mean?\n\nI would assume R means \"moved\". I am posting below what I found in the documentation, but nothing in this text says anything about 100 or numbers per se.\n\n--name-status\n Show only names and status of changed files. See the description of the --diff-filter option on what the status letters mean.\n\nand then\n\n--diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]]\n Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, …​) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected.\nAlso, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths.\nNote that not all diffs can feature all types. For instance, diffs from the index to the working tree can never have Added entries (because the set of paths included in the diff is limited by what is in the index). Similarly, copied and renamed entries cannot appear if detection for those types is disabled." }, { "role": "assistant", "content": "The documentation for git status under \"Changed Tracked Entries\" appears to explain what R100 means:\n\n<X><score> The rename or copy score (denoting the percentage\nof similarity between the source and target of the\nmove or copy). For example \"R100\" or \"C75\".\n\nSo, putting this together with what you cited above, the files you are seeing with R100 status mean that they were moved, and that Git found a 100% match between that file and some other previously named file.\nHere is a link to a good @torek answer, which described the physics of how Git tracks content." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Is there any way to undo the effects of \"git revert head\"?\nI've accidentally run the command against the wrong branch in my repository - is there a way to undo this change?" }, { "role": "assistant", "content": "git revert just creates a new commit -- you can \"remove\" it with git reset --hard HEAD^ (be more careful with it, though!)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to use gitlab-ci to manage test/construction of interdependent wheels\n\nI have 3 python packages proj1, proj12 and proj13. Both proj12 and\nproj13 depend on proj1 (with from proj1.xxx import yyy).\nThe 3 projects are on a private gitlab instance, each one has it's own .gitlab-ci.\nIn proj1 http://gitlab.me.com/group/proj1/.gitlab-ci.yml we run unittest\nand create a wheel exposed as an artifact::\n# http://gitlab.me.com/group/proj1/.gitlab-ci.yml\nimage: python:2\nmytest:\n artifacts:\n paths:\n - dist\n script:\n - apt-get update -qy; apt-get install -y python-dev python-pip\n - pip install -r requirements.txt\n - python setup.py test\n - python setup.py bdist_wheel\nlook:\n stage: deploy\n script:\n - ls -lah dist\n\nFor proj12 and proj13 in e.g.\nhttp://gitlab.me.com/group/proj12/.gitlab-ci.yml we would like to run tests\ntoo, but I need to install proj1 wheel to make it run.\nAll 3 projects are in the same gitlab private group.\nWhat is the gitlab way to do this ?\n\nto pass the proj1 wheel to the proj12 with an artifact\n\nin this case I don't know how to call/get the artifact in\nhttp://gitlab.me.com/group/proj12/.gitlab-ci.yml ? It's the same gitlab, the\nsame group, but a different project.\n\nUse a gitlab Secret Variable to store ssh_keys to clone proj2 in proj12/.gitlab-ci.yml ?\n\n\nrelated to https://gitlab.com/gitlab-org/gitlab-ce/issues/4194 \nthis does not take benefit of the fact that proj1, proj12 and\nproj13 are in the same gitlab and same group, the person who do the build\nfor one project as credentials to do the others. All 3 are connected by the user private token.\n\n\nI try to avoid to have to deploy devpi or pypiserver like solutions.\nSo I'm looking on what to write in the proj12 .gitlab-ci.yml to get the \ndist/proj1-0.42-py2-none-any.whl wheel from the proj1 precedent build::\n# http://gitlab.me.com/group/proj12/.gitlab-ci.yml\nimage: python:2\nmytest12:\n script:\n - apt-get update -qy; apt-get install -y python-dev python-pip\n - pip install -r requirements.txt\n - pip install .\n - => some way here to get the proj1 wheel \n - pip install proj1-0.42-py2-none-any.whl\n - python setup.py test\n\nLinks related to our issue:\n\nAllow access to build artifacts by using restricted access tokens https://gitlab.com/gitlab-org/gitlab-ce/issues/19628\n\"People need to be able to share links to artifacts based on a git ref (branch, tag, etc.), without knowing a specific build ID https://gitlab.com/gitlab-org/gitlab-ce/issues/4255\nhttps://docs.gitlab.com/ce/api/ci/builds.html#upload-artifacts-to-build \ndownload-the-artifacts-file https://docs.gitlab.com/ce/api/builds.html#download-the-artifacts-file https://gitlab.com/gitlab-org/gitlab-ce/issues/22957" }, { "role": "assistant", "content": "You have two ways you can do it:\n\nPass the object from previous build using the artifacts (works inside the same project only)\nBuild a docker image with your packages pre-installed in a git job, store it in the in-built registry and use that to run build in your other projects.\nClone the repository\n\nI would advise passing as an artifact since then you will have it build exactly in the pipeline you are running. As for the cloning, AFAIK you don't need any workaround when cloning submodules but for cloning other repositories I would go with ssh deploy key as it's connected with a repo and not a user like the private token." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-filter-branch - Rewrite branches -f --force" }, { "role": "assistant", "content": "git filter-branch refuses to start with an existing temporary\ndirectory or when there are already refs starting with refs/original/ , unless forced." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git with large files\nSituation\nI have two servers, Production and Development. On Production server, there are two applications and multiple (6) databases (MySQL) which I need to distribute to developers for testing. All source codes are stored in GitLab on Development server and developers are working only with this server and don't have access to production server. When we release an application, master logs into production and pulls new version from Git. The databases are large (over 500M each and counting) and I need to distribute them as easy as possible to developers for testing.\nPossible solutions\n\nAfter a backup script which dumps databases, each to a single file, execute a script which pushes each database to its own branch. A developer pulls one of these branches if he wants to update his local copy.\nThis one was found non working.\nCron on production server saves binary logs every day and pushes them into the branch of that database. So, in the branch, there are files with daily changes and developer pulls the files he doesn't have. The current SQL dump will be sent to the developer another way. And when the size of the repository becomes too large, we will send full dump to the developers and flush all data in the repository and start from the beginning.\n\nQuestions\n\nIs the solution possible?\nIf git is pushing/pulling to/from repository, does it upload/download whole files, or just changes in them (i.e. adds new lines or edits the current ones)?\nCan Git manage so large files? No.\nHow to set how many revisions are preserved in a repository? Doesn't matter with the new solution.\nIs there any better solution? I don't want to force the developers to download such large files over FTP or anything similar." }, { "role": "assistant", "content": "Update 2017:\nMicrosoft is contributing to Microsoft/GVFS: a Git Virtual File System which allows Git to handle \"the largest repo on the planet\"\n(ie: the Windows code base, which is approximately 3.5M files and, when checked in to a Git repo, results in a repo of about 300GB, and produces 1,760 daily “lab builds” across 440 branches in addition to thousands of pull request validation builds)\n\nGVFS virtualizes the file system beneath your git repo so that git and all tools see what appears to be a normal repo, but GVFS only downloads objects as they are needed.\n\nSome parts of GVFS might be contributed upstream (to Git itself).\nBut in the meantime, all new Windows development is now (August 2017) on Git.\n\nUpdate April 2015: GitHub proposes: Announcing Git Large File Storage (LFS)\nUsing git-lfs (see git-lfs.github.com) and a server supporting it: lfs-test-server, you can store metadata only in the git repo, and the large file elsewhere. Maximum of 2 Gb per commit.\n\nSee git-lfs/wiki/Tutorial:\ngit lfs track '*.bin'\ngit add .gitattributes \"*.bin\"\ngit commit -m \"Track .bin files\"\n\n\nOriginal answer:\nRegarding what the git limitations with large files are, you can consider bup (presented in details in GitMinutes #24)\nThe design of bup highlights the three issues that limits a git repo:\n\nhuge files (the xdelta for packfile is in memory only, which isn't good with large files)\nhuge number of file, which means, one file per blob, and slow git gc to generate one packfile at a time.\nhuge packfiles, with a packfile index inefficient to retrieve data from the (huge) packfile.\n\n\nHandling huge files and xdelta\n\nThe primary reason git can't handle huge files is that it runs them through xdelta, which generally means it tries to load the entire contents of a file into memory at once.\nIf it didn't do this, it would have to store the entire contents of every single revision of every single file, even if you only changed a few bytes of that file.\nThat would be a terribly inefficient use of disk space, and git is well known for its amazingly efficient repository format.\n\n\nUnfortunately, xdelta works great for small files and gets amazingly slow and memory-hungry for large files.\nFor git's main purpose, ie. managing your source code, this isn't a problem.\n\n\nWhat bup does instead of xdelta is what we call \"hashsplitting.\"\nWe wanted a general-purpose way to efficiently back up any large file that might change in small ways, without storing the entire file every time.\nWe read through the file one byte at a time, calculating a rolling checksum of the last 128\nbytes.\n\n\nrollsum seems to do pretty well at its job. You can find it in bupsplit.c.\nBasically, it converts the last 128 bytes read into a 32-bit integer. What we then do is take the lowest 13 bits of the rollsum, and if they're all 1's, we consider that to be the end of a chunk.\nThis happens on average once every 2^13 = 8192 bytes, so the average chunk size is 8192 bytes.\nWe're dividing up those files into chunks based on the rolling checksum.\nThen we store each chunk separately (indexed by its sha1sum) as a git blob.\n\n\nWith hashsplitting, no matter how much data you add, modify, or remove in the middle of the file, all the chunks before and after the affected chunk are absolutely the same.\nAll that matters to the hashsplitting algorithm is the 32-byte \"separator\" sequence, and a single change can only affect, at most, one separator sequence or the bytes between two separator sequences.\nLike magic, the hashsplit chunking algorithm will chunk your file the same way every time, even without knowing how it had chunked it previously.\n\n\nThe next problem is less obvious: after you store your series of chunks as git blobs, how do you store their sequence? Each blob has a 20-byte sha1 identifier, which means the simple list of blobs is going to be 20/8192 = 0.25% of the file length.\nFor a 200GB file, that's 488 megs of just sequence data.\n\n\nWe extend the hashsplit algorithm a little further using what we call \"fanout.\" Instead of checking just the last 13 bits of the checksum, we use additional checksum bits to produce additional splits.\nWhat you end up with is an actual tree of blobs - which git 'tree' objects are ideal to represent.\n\nHandling huge numbers of files and git gc\n\ngit is designed for handling reasonably-sized repositories that change relatively infrequently. You might think you change your source code \"frequently\" and that git handles much more frequent changes than, say, svn can handle.\nBut that's not the same kind of \"frequently\" we're talking about.\n\n\nThe #1 killer is the way it adds new objects to the repository: it creates one file per blob. Then you later run 'git gc' and combine those files into a single file (using highly efficient xdelta compression, and ignoring any files that are no longer relevant).\n\n\n'git gc' is slow, but for source code repositories, the resulting super-efficient storage (and associated really fast access to the stored files) is worth it.\n\n\nbup doesn't do that. It just writes packfiles directly.\nLuckily, these packfiles are still git-formatted, so git can happily access them once\nthey're written.\n\nHandling huge repository (meaning huge numbers of huge packfiles)\n\nGit isn't actually designed to handle super-huge repositories.\nMost git repositories are small enough that it's reasonable to merge them all into a single packfile, which 'git gc' usually does eventually.\n\n\nThe problematic part of large packfiles isn't the packfiles themselves - git is designed to expect the total size of all packs to be larger than available memory, and once it can handle that, it can handle virtually any amount of data about equally efficiently.\nThe problem is the packfile indexes (.idx) files.\n\n\neach packfile (*.pack) in git has an associated idx (*.idx) that's a sorted list of git object hashes and file offsets.\nIf you're looking for a particular object based on its sha1, you open the idx, binary search it to find the right hash, then take the associated file offset, seek to that offset in the packfile, and read the object contents.\n\n\nThe performance of the binary search is about O(log n) with the number of hashes in the pack, with an optimized first step (you can read about it elsewhere) that somewhat improves it to O(log(n)-7).\nUnfortunately, this breaks down a bit when you have lots of packs.\n\n\nTo improve performance of this sort of operation, bup introduces midx (pronounced \"midix\" and short for \"multi-idx\") files.\nAs the name implies, they index multiple packs at a time." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to convert SSH keypairs generated using PuTTYgen (Windows) into key-pairs used by ssh-agent and Keychain (Linux)\nI've generated key pairs using PuTTYgen and been logging in using Pageant, so that I have to enter my pass-phrase only once when my system boots. \nHow do I achieve this in Linux? I've heard of keychain but I hear that it uses a different key pair format - I don't want to change my Windows keys and it would be nice if I could seamlessly connect in the same manner in both Windows and Linux." }, { "role": "assistant", "content": "puttygen supports exporting your private key to an OpenSSH compatible format. You can then use OpenSSH tools to recreate the public key.\n\nOpen PuttyGen\nClick Load\nLoad your private key\nGo to Conversions->Export OpenSSH and export your private key\nCopy your private key to ~/.ssh/id_dsa (or id_rsa).\nCreate the RFC 4716 version of the public key using ssh-keygen\nssh-keygen -e -f ~/.ssh/id_dsa > ~/.ssh/id_dsa_com.pub\n\nConvert the RFC 4716 version of the public key to the OpenSSH format:\nssh-keygen -i -f ~/.ssh/id_dsa_com.pub > ~/.ssh/id_dsa.pub\n\n\nSee this and this for more information." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to resolve \"refusing to allow an OAuth App to create or update workflow\" on git push\n\nGetting\n\nrefusing to allow an OAuth App to create or update workflow .github/workflows/cd.yml without workflow scope\"\n\non git push. How to grant workflow scope?" }, { "role": "assistant", "content": "I've literally just come across this problem when trying to use IntelliJ to push to a branch that contains a GitHub Action workflow (YAML file in .github/workflows). I didn't find existing resources on the Internet very helpful, so I hope this will help you fix it too.\nTL;DR: Update your Personal Access Token with the workflow scope enabled in GitHub, or create a new one, and configure your application to use that.\nBackground: third-party tools with GitHub integrations like IntelliJ, Visual Studio Code, Github Desktop, etc use tokens to connect to your GitHub account so they can pull/push, etc on your behalf. In the case of IntelliJ, their instructions only say to include the repo, the gist, and the read:org scopes. But you need the workflow scope to modify GitHub Actions.\nHere's how to fix it:\n\nIn your Github account, go to Settings (in your avatar dropdown in the top right-hand corner)\nGo to Developer Settings > Personal Access Tokens\nIf your token is listed, update it to include the workflow scope:\n\nClick on the token name.\nSelect workflow scope and save.\nIf the app you use won't re-fetch permissions for your token automatically, you may have to create a new one (step 4 below).\nClick on Update Token to save the change. DONE!\n\n\nIf there's no token listed there, generate a new one:\n\nClick on Generate Token.\nSelect the scopes you need, including workflow.\nRead the information carefully, then click OK to continue.\nCopy the new token that Github shows you.\nApply the new token to your application. For example, for the Intellij IDE, go to Settings > Version Control > GitHub, remove the existing integration and re-add it, pasting in the new token." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker -c <name>=<value>" }, { "role": "assistant", "content": "Pass a configuration parameter to the command. The value\ngiven will override values from configuration files.\nThe <name> is expected in the same format as listed by git config (subkeys separated by dots). Note that omitting the = in git -c foo.bar ... is allowed and sets foo.bar to the boolean true value (just like [foo]bar would in a\nconfig file). Including the equals but with an empty value (like git -c\nfoo.bar= ... ) sets foo.bar to the empty string which git config\n--type=bool will convert to false ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-range-diff - Compare two commit ranges (e.g. two versions of a branch)" }, { "role": "assistant", "content": "EXAMPLES When a rebase required merge conflicts to be resolved, compare the changes\nintroduced by the rebase directly afterwards using: $ git range-diff @{u} @{1} @ A typical output of git range-diff would look like this: -: ------- > 1: 0ddba11 Prepare for the inevitable!\n1: c0debee = 2: cab005e Add a helpful message at the start\n2: f00dbal ! 3: decafe1 Describe a bug\n @@ -1,3 +1,3 @@\n Author: A U Thor <[email protected]>\n\n -TODO: Describe a bug\n +Describe a bug\n @@ -324,5 +324,6\n This is expected.\n\n -+What is unexpected is that it will also crash.\n ++Unexpectedly, it also crashes. This is a bug, and the jury is\n ++still out there how to fix it best. See ticket #314 for details.\n\n Contact\n3: bedead < -: ------- TO-UNDO In this example, there are 3 old and 3 new commits, where the developer\nremoved the 3rd, added a new one before the first two, and modified the\ncommit message of the 2nd commit as well as its diff. When the output goes to a terminal, it is color-coded by default, just\nlike regular git diff 's output. In addition, the first line (adding a\ncommit) is green, the last line (deleting a commit) is red, the second\nline (with a perfect match) is yellow like the commit header of git\nshow 's output, and the third line colors the old commit red, the new\none green and the rest like git show 's commit header. A naive color-coded diff of diffs is actually a bit hard to read,\nthough, as it colors the entire lines red or green. The line that added\n\"What is unexpected\" in the old commit, for example, is completely red,\neven if the intent of the old commit was to add something. To help with that, range uses the --dual-color mode by default. In\nthis mode, the diff of diffs will retain the original diff colors, and\nprefix the lines with -/+ markers that have their background red or\ngreen, to make it more obvious that they describe how the diff itself\nchanged." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git fatal: protocol 'https' is not supported\nI am going through Github's forking guide: https://guides.github.com/activities/forking/\nand I am trying to clone the repository onto my computer. However, running the command:\n$ git clone https://github.com/./Spoon-Knife.git\nCloning into 'Spoon-Knife'...\nfatal: protocol 'https' is not supported\n\nAlso tried with SSH:\n$ git clone [email protected]:./Spoon-Knife.git\nCloning into 'Spoon-Knife'...\nWarning: Permanently added the RSA host key for IP address '.' to the list of known hosts.\n[email protected]: Permission denied (publickey).\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nDo I need to change some configuration setting on my computer or is this a problem with GitHub?\nEdit: I have replaced my username and IP address with \".\"" }, { "role": "assistant", "content": "The problem is probably this:\n\nYou tried to paste it using CTRL + V before and it didn't work,\nso you went ahead and pasted it with classic Right Click.\nSadly, whenever you enter CTRL + V on terminal it adds a hidden ^? (at least on my machine it is encoded like that) character that only appears after you backspace (go ahead and try it on git bash).\n\nSo your link becomes ^?https://... which is invalid." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-cat-file - Provide contents or details of repository objects rest" }, { "role": "assistant", "content": "If this atom is used in the output string, input lines are split\nat the first whitespace boundary. All characters before that\nwhitespace are considered to be the object name; characters\nafter that first run of whitespace (i.e., the \"rest\" of the\nline) are output in place of the %(rest) atom." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git file permissions on Windows\nI've read through a few questions regarding file permissions in Git and I'm still a bit confused. I've got a repo on GitHub forked from another. Post merge, they should be identical. However:\n$ git diff --summary origin/epsilon master/epsilon\n mode change 100644 => 100755 ants/dist/sample_bots/csharp/compile.sh\n mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/MyBot.coffee\n mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/ants.coffee\n mode change 100644 => 100755 ants/util/block_test.sh\n mode change 100644 => 100755 manager/mass_skill_update.py\n mode change 100644 => 100755 worker/jailguard.py\n mode change 100644 => 100755 worker/release_stale_jails.py\n mode change 100644 => 100755 worker/start_worker.sh\n\nI've tried changing file permissions, but it does not alter the diff results." }, { "role": "assistant", "content": "I found the solution of how to change permissions (also) on Windows here: http://blog.lesc.se/2011/11/how-to-change-file-premissions-in-git.html\nFor example following command adds user execute permission to an arbitrary file:\ngit update-index --chmod=+x <file>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Could not execute editor\nI don't often have to modify multiple commit messages, but it has happened once or twice and I don't ever remember seeing this. I hope someone else has. When I git rebase -i HEAD~7, the expected list opens in vi exactly as expected. I change the pick values to edit where appropriate and then :wq.\n\nCould not execute editor\n\nThe core.editor setting in my global .gitconfig is vi (I've also changed it to vim in a wildly desperate move). I tried using mate, but that didn't even open the initial list properly so I changed it back.\nI'm using v1.7.3 and would welcome any suggestions." }, { "role": "assistant", "content": "Yesterday was just one of those days. On a lark, I decided to set the full path to vi (e.g. /usr/bin/vi) rather than just the executable. Now everything works. I have to admit that I don't get it since vi is perfectly executable on its own (my $EDITOR env variable is also set to vi), but it's working and my technical karma hasn't been so great lately so maybe I just shouldn't question the deities will..." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-commit - Record changes to the repository -u[<mode>] --untracked-files[=<mode>]" }, { "role": "assistant", "content": "Show untracked files. The mode parameter is optional (defaults to all ), and is used to\nspecify the handling of untracked files; when -u is not used, the\ndefault is normal , i.e. show untracked files and directories. The possible options are: no - Show no untracked files normal - Shows untracked files and directories all - Also shows individual files in untracked directories. All usual spellings for Boolean value true are taken as normal and false as no .\nThe default can be changed using the status.showUntrackedFiles\nconfiguration variable documented in git-config ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "docker error on windows : the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty' [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nError \"The input device is not a TTY\"\n\n (17 answers)\n \n\nClosed 3 years ago.\n\n\n\nAfter I run this\ndocker run --rm -v \"/c/users/vipul rao/documents/github/wappalyzer:/opt/wappalyzer\" -it wappalyzer/dev\n\nI am getting the following error\n\nthe input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'\n\nWhat should I use here? I am running Docker on Windows 8 in MINGW64." }, { "role": "assistant", "content": "As suggested by the error message you obtain, you should try to use winpty (which is installed by default with Git-Bash) and thus run:\nwinpty docker run --rm -v \"/c/users/vipul rao/documents/github/wappalyzer:/opt/wappalyzer\" -it wappalyzer/dev\n\nIf this works, you may want to set a Bash alias to avoid manually prepending winpty all the time:\necho \"alias docker='winpty docker'\" >> ~/.bashrc\n\nor\necho \"alias docker='winpty docker'\" >> ~/.bash_profile" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-ls-files - Show information about files in the index and the working tree --abbrev[=<n>]" }, { "role": "assistant", "content": "Instead of showing the full 40-byte hexadecimal object\nlines, show the shortest prefix that is at least <n> hexdigits long that uniquely refers the object.\nNon default number of digits can be specified with --abbrev=<n>." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is a dangling commit and a blob in a Git repository and where do they come from?\nI'm looking for the basic information on dangling commits and blobs.\nMy repository seems fine. But I ran git fsck for the first time to see what it did and I have a long list of 'dangling blobs' and a single 'dangling commit'.\nWhat are these things? Where did they come from? Do they indicate anything unusual (good or bad) about the state of my repository?" }, { "role": "assistant", "content": "During the course of working with your Git repository, you may end up backing out of operations, and making other moves that cause intermediary blobs, and even some things that Git does for you to help avoid loss of information.\nEventually (conditionally, according to the git gc man page) it will perform garbage collection and clean these things up. You can also force it by invoking the garbage collection process, git gc.\nFor more information about this, see Maintenance and Data Recover on the git-scm site.\nA manual run of GC will by default leave two weeks prior to the runtime of this command as a safety net. It is in fact encouraged to run the GC occasionally to help ensure performant use of your Git repository. Like anything, though, you should understand what it is doing before destroying those things that may be important to you." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I use Git locally?\nI'm working on a project at the moment, which I'd like to eventually make public on github, but, for the moment, needs to remain private.\nGithub needs users to pay in order to host a private repository, which I'm unwilling to do, so just creating a private github repository is not an option for me.\nHowever, I would still like to use git for version tracking etc. whilst I'm working on the project locally, so that when I do eventually put the project on github, all of this information, the project's changes start-to-finish, will be available.\nBut, I have no clue how to use git without a remote server. I'm wondering now if it just exactly the same, simply without the need for git push.\nThe perfect answer for me would be a step-by-step walkthrough, telling me exactly what I should type into the terminal to set up and maintain a local git repository." }, { "role": "assistant", "content": "You only need to push if you want to use a remote server.\nWhen working locally, you still need to git init to set up the repository, but after that you only need to do the steps\ngit add\ngit commit -m \"new commit\"\n\nto save (\"commit\") your changes.\nDon't git push at all, and don't git pull — there's no remote to sync changes with (git push and git pull just push and pull changes from the remote/online repository).\nType:\ngit log\n\nTo see that your changes have been recorded." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Add GitHub library as dependency to Android Studio project\n\nI am trying to implement ActionBar-PullToRefresh from https://github.com/chrisbanes/ActionBar-PullToRefresh/wiki/QuickStart-ABC. I just made the switch from Eclipse to Android Studio so I am totally new to AS and Gradle.\nchrisbanes writes on the site:\n\nThe easiest way to add ActionBar-PullToRefresh to your project is via\nGradle, you just need to add the following dependency to your\nbuild.gradle:\n\ndependencies { \n mavenCentral()\n compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'\n}\n\nDoes this mean that I don't have to download the library and Gradle takes care of it so that I always have the latest version? I just don't know where to put the above line. I have two gradle.build files one in my root that looks like:\n// Top-level build file where you can add configuration options common to all sub-projects/modules.\nbuildscript {\n repositories {\n mavenCentral()\n }\n dependencies {\n classpath 'com.android.tools.build:gradle:0.8.+'\n }\n}\n\nand the one in my project which looks like:\napply plugin: 'android'\n\ndependencies {\n compile fileTree(dir: 'libs', include: '*.jar')\n compile 'com.android.support:support-v4:18.0.+'\n compile 'com.android.support:appcompat-v7:18.0.+'\n}\n\nandroid {\n compileSdkVersion 19\n buildToolsVersion \"19.0.1\"\n\n sourceSets {\n main {\n manifest.srcFile 'AndroidManifest.xml'\n java.srcDirs = ['src']\n resources.srcDirs = ['src']\n aidl.srcDirs = ['src']\n renderscript.srcDirs = ['src']\n res.srcDirs = ['res']\n assets.srcDirs = ['assets']\n }\n\n // Move the tests to tests/java, tests/res, etc...\n instrumentTest.setRoot('tests')\n\n // Move the build types to build-types/<type>\n // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...\n // This moves them out of them default location under src/<type>/... which would\n // conflict with src/ being used by the main source set.\n // Adding new build types or product flavors should be accompanied\n // by a similar customization.\n debug.setRoot('build-types/debug')\n release.setRoot('build-types/release')\n }\n}\n\nDo I have to add a repository somewhere?" }, { "role": "assistant", "content": "It will work when you put this line in your project build.gradle, in the dependencies section:\ncompile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'\n\nAlso, add:\nrepositories {\n mavenCentral()\n}\n\nSo:\nrepositories {\n mavenCentral()\n}\n\ndependencies {\n compile fileTree(dir: 'libs', include: '*.jar')\n compile 'com.android.support:support-v4:18.0.+'\n compile 'com.android.support:appcompat-v7:18.0.+'\n compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'\n}\n\nGradle will download the needed resources automatically for you." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options diff.statNameWidth" }, { "role": "assistant", "content": "Limit the width of the filename part in --stat output. If set, applies\nto all commands generating --stat output except format-patch." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-clone - Clone a repository into a new directory clone.rejectShallow" }, { "role": "assistant", "content": "Reject cloning a repository if it is a shallow one; this can be overridden by\npassing the --reject-shallow option on the command line." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --no-filter" }, { "role": "assistant", "content": "Turn off any previous --filter= argument." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What's the difference between tag and release?\n\nUsing GitHub's API, I can't get the releases list, but I can get the tags list.\nWhat's the difference between them?" }, { "role": "assistant", "content": "What's the difference between them?\n\nA tag is a pointer to a specific commit. This pointer can be super charged with some additional information (identity of the creator of the tag, a description, a GPG signature, ...).\nA tag is a git concept whereas a Release is GitHub higher level concept.\nAs stated in the official announcement post from the GitHub blog: \"Releases are first-class objects with changelogs and binary assets that present a full project history beyond Git artifacts.\"\nA Release is created from an existing tag and exposes release notes and links to download the software or source code from GitHub.\n\nUsing GitHub's API, I can't get the releases list, but I can get the tags list.\n\nThe current version of the GitHub API doesn't expose a way to manage Releases (create, update, ...). I'm pretty sure that this shouldn't take too long before it's exposed.\nHowever, it's currently possible to list the releases and tags of a specific repository.\nFor instance, the url below will list the 6 releases (as of today) from ReactiveUI\n\nhttps://api.github.com/repos/reactiveui/ReactiveUI/releases\n\nWhereas this one will list the 54 tags (as of today) from the same repository\n\nhttps://api.github.com/repos/reactiveui/ReactiveUI/tags\n\nCreating a release is currently in a process which involves a manual action (adding the release notes, uploading the packages, ...). This explains why tags are not transparently seen as Releases.\n\nIf you want to be notified of the API changes, you can subscribe to the GitHub API Changes blog.\nHowever, if you can't wait, the GitHub API home page states \"If you have any problems or requests please contact support.\". This can be done through an email to [email protected] or this contact form.\nUpdate:\nThe GitHub API now allows to manipulate Releases. See the announcement." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "gittutorial - A tutorial introduction to Git" }, { "role": "assistant", "content": "Managing branches A single Git repository can maintain multiple branches of\ndevelopment. To create a new branch named experimental , use $ git branch experimental If you now run $ git branch you’ll get a list of all existing branches: experimental\n* master The experimental branch is the one you just created, and the master branch is a default branch that was created for you\nautomatically. The asterisk marks the branch you are currently on;\ntype $ git switch experimental to switch to the experimental branch. Now edit a file, commit the\nchange, and switch back to the master branch: (edit file)\n$ git commit -a\n$ git switch master Check that the change you made is no longer visible, since it was\nmade on the experimental branch and you’re back on the master branch. You can make a different change on the master branch: (edit file)\n$ git commit -a at this point the two branches have diverged, with different changes\nmade in each. To merge the changes made in experimental into master , run $ git merge experimental If the changes don’t conflict, you’re done. If there are conflicts,\nmarkers will be left in the problematic files showing the conflict; $ git diff will show this. Once you’ve edited the files to resolve the\nconflicts, $ git commit -a will commit the result of the merge. Finally, $ gitk will show a nice graphical representation of the resulting history. At this point you could delete the experimental branch with $ git branch -d experimental This command ensures that the changes in the experimental branch are\nalready in the current branch. If you develop on a branch crazy-idea , then regret it, you can always\ndelete the branch with $ git branch -D crazy-idea Branches are cheap and easy, so this is a good way to try something\nout." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Automatic prune with Git fetch or pull\nIf someone deleted a remote branch because the work is over and I don't know, I won't do a git fetch --prune and eventually I will push back the deleted branch.\nIs there a viable solution for forcing Git to use the prune mode when fetching / pulling without having to specify it every time?" }, { "role": "assistant", "content": "Since git 1.8.5 (Q4 2013):\n\n\"git fetch\" (hence \"git pull\" as well) learned to check \"fetch.prune\" and \"remote.*.prune\" configuration variables and to behave as if the \"--prune\" command line option was given.\n\nThat means that, if you set remote.origin.prune to true:\ngit config remote.origin.prune true\n\nAny git fetch or git pull will automatically prune.\nNote: Git 2.12 (Q1 2017) will fix a bug related to this configuration, which would make git remote rename misbehave.\nSee \"How do I rename a git remote?\".\n\nSee more at commit 737c5a9:\n\nWithout \"git fetch --prune\", remote-tracking branches for a branch the other side already has removed will stay forever.\n Some people want to always run \"git fetch --prune\".\nTo accommodate users who want to either prune always or when fetching from a particular remote, add two new configuration variables \"fetch.prune\" and \"remote.<name>.prune\":\n\n\"fetch.prune\" allows to enable prune for all fetch operations.\n\"remote.<name>.prune\" allows to change the behaviour per remote.\n\nThe latter will naturally override the former, and the --[no-]prune option from the command line will override the configured default.\nSince --prune is a potentially destructive operation (Git doesn't keep reflogs for deleted references yet), we don't want to prune without users consent, so this configuration will not be on by default." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options diff.interHunkContext" }, { "role": "assistant", "content": "Show the context between diff hunks, up to the specified number\nof lines, thereby fusing the hunks that are close to each other.\nThis value serves as the default for the --inter-hunk-context command line option." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I determine if a given git hash exists on a given branch?\nBackground: I use an automated build system which takes a git hash as input, as well as the name of the branch on which that hash exists, and builds it. However, the build system uses the hash alone to check out the code and build it -- it simply stores the branch name, as given, in the build DB metadata.\nI'm worried about developers accidentally providing the wrong branch name when they kick off a build, causing confusion when people are looking through the build history.\nSo how can I confirm, before passing along the hash and branch name to the build system, that the given hash does in fact come from the given branch?" }, { "role": "assistant", "content": "You can ask git branch directly which branches contain the commit in question:\n% git branch -a --contains 4f08c85ad\n* master\n remotes/origin/bug_872\n remotes/origin/bug_898\n remotes/origin/master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order -g --walk-reflogs" }, { "role": "assistant", "content": "Instead of walking the commit ancestry chain, walk\nreflog entries from the most recent one to older ones.\nWhen this option is used you cannot specify commits to\nexclude (that is, ^commit , commit1..commit2 ,\nand commit1...commit2 notations cannot be used). With --pretty format other than oneline and reference (for obvious reasons),\nthis causes the output to have two extra lines of information\ntaken from the reflog. The reflog designator in the output may be shown\nas ref@{<Nth>} (where <Nth> is the reverse-chronological index in the\nreflog) or as ref@{<timestamp>} (with the <timestamp> for that entry),\ndepending on a few rules: If the starting point is specified as ref@{<Nth>} , show the index\nformat. If the starting point was specified as ref@{now} , show the\ntimestamp format. If neither was used, but --date was given on the command line, show\nthe timestamp in the format requested by --date . Otherwise, show the index format. Under --pretty=oneline , the commit message is\nprefixed with this information on the same line.\nThis option cannot be combined with --reverse .\nSee also git-reflog . Under --pretty=reference , this information will not be shown at all." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-read-tree - Reads tree information into the index --index-output=<file>" }, { "role": "assistant", "content": "Instead of writing the results out to $GIT_INDEX_FILE ,\nwrite the resulting index in the named file. While the\ncommand is operating, the original index file is locked\nwith the same mechanism as usual. The file must allow\nto be rename(2)ed into from a temporary file that is\ncreated next to the usual index file; typically this\nmeans it needs to be on the same filesystem as the index\nfile itself, and you need write permission to the\ndirectories the index file and index output file are\nlocated in." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Exclude file from \"git diff\"\nI am trying to exclude a file (db/irrelevant.php) from a Git diff. I have tried putting a file in the db subdirectory called .gitattributes with the line irrelevant.php -diff\nand I have also tried creating a file called .git/info/attributes containing db/irrelevant.php. \nIn all cases, the db/irrelevant.php file is included in the diff as a Git binary patch. What I want is for the changes to that file to be ignore by the diff command. What am I doing wrong?" }, { "role": "assistant", "content": "OMG, drivers and AWK to exclude a lousy file? Since Git 1.9 something you can:\ngit diff -- . ':(exclude)db/irrelevant.php' ':(exclude)db/irrelevant2.php'\n\n(On Windows, replace the single quotes ' by double quotes \".)\nAh, elegance! See the quoted answer and for details this answer by @torek." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I backport a commit in git?\nSo, I have a maintenance branch and a master branch in my project. If I make a commit in the maintenance branch and want to merge it forward to the master branch, that's easy:\ngit checkout master; git merge maintenance\n\nBut if I want to go the other way around, i.e. apply a commit made to master back to my maintenance branch, how do I do that? Is this considered cherry-picking? Will it cause problems or conflicts if I merge the maintenance branch forward again?" }, { "role": "assistant", "content": "This is exactly the use case for git-cherry-pick\ngit checkout maintenance\ngit cherry-pick <commit from master>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fast-import - Backend for fast Git data importers --done" }, { "role": "assistant", "content": "Terminate with error if there is no done command at the end of\nthe stream. This option might be useful for detecting errors\nthat cause the frontend to terminate before it has started to\nwrite a stream." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Code block in spoiler with markdown\n\nIs there any way in markdown to combine the code (inside ```) with the spoiler (after !>) syntax in order to obtain some code inside a spoiler ?\nI'm using the markdown implemented in GitLab." }, { "role": "assistant", "content": "https://docs.gitlab.com/ee/user/markdown.html#details-and-summary\nYou can use raw HTML\n<p>\n<details>\n<summary>Click this to collapse/fold.</summary>\n\nThese details <em>remain</em> <strong>hidden</strong> until expanded.\n\n<pre><code>PASTE LOGS HERE</code></pre>\n\n</details>\n</p>\n\nor now GitLab supports Markdown within <details> blocks\n<details>\n<summary>Click this to collapse/fold.</summary>\n\nThese details _remain_ **hidden** until expanded.\n\n```\nPASTE LOGS HERE\n```\n\n</details>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker gitremote-helpers" }, { "role": "assistant", "content": "Helper programs to interact with remote repositories" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab custom domain, failed to verify domain ownership\n\nI don't think I need to use the subdomain. I have created a A record and a TXT record as the doc suggests on namecheap.com. After wait for 24 hours, I sill get a failed to verify domain ownership error." }, { "role": "assistant", "content": "Remove your CNAME record. Also, remove the URL redirection and your first TXT record. You shouldn't be using both CNAME and A records together.\n\nIf using a DNS A record, you can place the TXT record directly under the domain. If using a DNS CNAME record, the two record types won't co-exist, so you need to place the TXT record in a special subdomain of its own. [source]\n\nSo your final configuration would be:\nA Record @ 35.185.44.232\nTXT Record @ gitlab-pages-verification-code=XXXXXX" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Building merge requests in CI server\n\nWe are using GitLab to manage our repos. We are trying to follow GitFlow processes and as part of that we would like to be able to build and execute the tests against any merge request automatically in TeamCity.\nFrom what I can see this is possible in GitLab CI but moving over to that isn't a realistic option for us.\nI have seen tutorials about achieving this on GitHUB using a branch specification like +refs/pull/*/merge - does a similar branch specification get created by GitLAB?\nWe are using version 4.2 of GitLab but can upgrade if required for this feature and version 8 of TeamCity" }, { "role": "assistant", "content": "I have GitLab 6.3 and TeamCity 8 and I need build feature branches too. We have following workflow (it is based on git-flow, but slightly changed according to our release cycle).\nSo, we have development branch and one pushes feature branch with a specific name dev/feature-name-here. \nNext, one creating a Merge Request in GitLab from dev/feature-name-here to development.\nTeamCity is configured to automatically run builds for each branch with the following refspec: +:refs/heads/dev/(*) so we can see a build for branch feature-name-here is automatically started.\nNext, I have a custom script which is embedded to GitLab's merge request page. It do the following.\n\nDetects a source and target branch by looking at a MR page\nWith TeamCity REST API enumerates build which is belongs to a target branch (in TeamCity 8 we can assign custom build configuration ID to build so we using some semantic naming like devUnit, devIntegration, devWhatever, etc...)\nCreates a table witch contains build status images for source and target branches for each related build configuration.\n\nNow it looks like this:\n\nNow this approach has some drawbacks like if one updates a branch with another push I can't figure out from GitLab page is new commits is already built or I'm seeng old build status, so I need to click on a build link and check in TeamCity" } ]