messages
listlengths 3
3
|
---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "push an 'unchecked out' branch\nI want to push a branch (not the current) without having to check it out first, how can I achieve that ?\nthis is how I'd do:\n#currently in master\ngit checkout feature\ngit push origin feature\ngit checkout master\n\nbut checking out feature can cause conflicts, can't I just push another branch than the current one ?"
},
{
"role": "assistant",
"content": "Simply:\ngit push origin feature:feature\n\nOr shorter:\ngit push origin feature"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I call 'git pull' from within Python?\n\nUsing the github webhooks, I would like to be able to pull any changes to a remote development server. At the moment, when in the appropriate directory, git pull gets any changes that need to be made. However, I can't figure out how to call that function from within Python. I have tried the following:\nimport subprocess\nprocess = subprocess.Popen(\"git pull\", stdout=subprocess.PIPE)\noutput = process.communicate()[0]\n\nBut this results in the following error\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\n File \"/usr/lib/python2.7/subprocess.py\", line 679, in __init__\n errread, errwrite)\n File \"/usr/lib/python2.7/subprocess.py\", line 1249, in _execute_child\n raise child_exception\nOSError: [Errno 2] No such file or directory\n\nIs there a way that I can call this bash command from within Python?"
},
{
"role": "assistant",
"content": "Have you considered using GitPython? It's designed to handle all this nonsense for you.\nimport git # pip install gitpython\n\n\ng = git.cmd.Git(git_dir)\ng.pull()\n\nTo install the module use pip install GitPython\nProject can be found here, GitPython"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can I do a partial revert in GIT\nIs it possible to revert only a single file or certain changes in a file in multi file commit?\nFull story\nI committed a bunch of files. A number of commits later someone who will remain nameless (JACK!!!) copied a file into his repository and committed several files, overwriting some of the changes I did. I want to revert the one file that got clobbered or better yet, go in and revert two changes in that file. This will have to be a separate revert commit since it was pulled and pushed."
},
{
"role": "assistant",
"content": "You can revert the commit without creating a new one by adding the --no-commit option. This leaves all the reverted files in the staging area.\nFrom there, I'd perform a mixed reset (the default for reset) to un-stage the files, and add in the changes I really wanted. Then, commit, (you can add and commit more files if you want multiple commits), and finally, checkout the current directory to wipe out any uncommitted and un-staged modifications resulting from the revert. For an example workflow:\ngit revert <sha-of-bad-commit> --no-commit\ngit reset # This gets them out of the staging area\n\n# ...edit bad file to look like it should, if necessary\n\ngit add <bad-file>\ngit commit\ngit checkout . # This wipes all the undesired reverts still hanging around in the working copy"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GIT_COMMITTER_DATE not recognized\n\nThis is probably an extremely simple question but I'm trying to modify the date of a Git commit but whenever I try to modify the Git environment variables GIT_COMMITTER_DATE or GIT_AUTHOR_DATE I get this message.\nWhen I type git var -l they don't show up either.\nDo I have to add those variables myself?\nC:\\Users\\MolinaBA\\Desktop\\MCPInfoGitMigrationTest>GIT_COMMITTER_DATE=\"12/12/12 4:40p +0000\" git commit --amend --no-edit\n\n'GIT_COMMITTER_DATE' is not recognized as an internal or external command,\noperable program or batch file."
},
{
"role": "assistant",
"content": "You need to first set the GIT_COMMITTER_DATE variable and then try git commit --amend. Shown below:\n> set GIT_COMMITTER_DATE=\"12/12/12 4:40p +0000\"\n> git commit --amend --no-edit\n\nSimilar step for GIT_AUTHOR_DATE.\n> set GIT_AUTHOR_DATE=\"12/12/12 4:40p +0000\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Pull request vs Merge request\n\nWhat is the difference between a Pull request and a Merge request?\nIn GitHub, it's a Pull Request while in GitLab, for example, it's a Merge Request. So, is there a difference between both of these?"
},
{
"role": "assistant",
"content": "GitLab's \"merge request\" feature is equivalent to GitHub's \"pull request\" feature. Both are means of pulling changes from another branch or fork into your branch and merging the changes with your existing code. They are useful tools for code review and change management.\nAn article from GitLab discusses the differences in naming the feature:\n\nMerge or pull requests are created in a git management application and ask an assigned person to merge two branches. Tools such as GitHub and Bitbucket choose the name pull request since the first manual action would be to pull the feature branch. Tools such as GitLab and Gitorious choose the name merge request since that is the final action that is requested of the assignee. In this article we'll refer to them as merge requests.\n\nA \"merge request\" should not be confused with the git merge command. Neither should a \"pull request\" be confused with the git pull command. Both git commands are used behind the scenes in both pull requests and merge requests, but a merge/pull request refers to a much broader topic than just these two commands."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-send-pack"
},
{
"role": "assistant",
"content": "Push objects over Git protocol to another repository"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-blame - Show what revision and author last modified each line of a file -s"
},
{
"role": "assistant",
"content": "Suppress the author name and timestamp from the output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to revert an unnecessary \"git reset HEAD~1\"\nAfter running git reset HEAD~1, I noticed that actually there was nothing else to do and the commit was fine. Is there a way to revert this command?"
},
{
"role": "assistant",
"content": "You can use:\ngit reset HEAD@{1}\n\nThis uses the last entry in the reflog. See git reflog if you did other things in between."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_NOGLOB_PATHSPECS"
},
{
"role": "assistant",
"content": "Setting this Boolean environment variable to true will cause Git to treat all\npathspecs as literal (aka \"literal\" magic)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-commit - Record changes to the repository -t <file> --template=<file>"
},
{
"role": "assistant",
"content": "When editing the commit message, start the editor with the\ncontents in the given file. The commit.template configuration\nvariable is often used to give this option implicitly to the\ncommand. This mechanism can be used by projects that want to\nguide participants with some hints on what to write in the message\nin what order. If the user exits the editor without editing the\nmessage, the commit is aborted. This has no effect when a message\nis given by other means, e.g. with the -m or -F options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-submodule - Initialize, update or inspect submodules --merge"
},
{
"role": "assistant",
"content": "This option is only valid for the update command.\nMerge the commit recorded in the superproject into the current branch\nof the submodule. If this option is given, the submodule’s HEAD will\nnot be detached. If a merge failure prevents this process, you will\nhave to resolve the resulting conflicts within the submodule with the\nusual conflict resolution tools.\nIf the key submodule.$name.update is set to merge , this option is\nimplicit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to use git-bundle for keeping development in sync?\nI need to keep my development trees in sync on different computers, with no network connection between them.\nWe have a central git repository, and I normally work on my own clone on my office computer. Sometimes I need to do some development on another computer, which is never connected to the office network. None of the computers are ever connected to Internet. Development may be performed on both computers between synchronizations.\nI have read the help pages for git-bundle, which seems like the best tool, but I am not really sure how a good workflow could be set up. \nCan you give me some advice or pointers?"
},
{
"role": "assistant",
"content": "Bundles!\nThe workflow with git bundle is going to be essentially the same as any other workflow. This may not seem like terribly helpful advice, but here it is: use whatever workflow you would normally use, and replace \"push/pull\" with \"carry a bundle here to there on a flash drive, then pull\".\nThe man page actually has a pretty good walkthrough for getting going with this, although it's more of a one-way example. For the sake of completeness, here's a slightly modified version of it, showing how to move information both ways:\n# on hostA, the initial home of the repo\nhostA$ git bundle create hostA.bundle --branches --tags\n\n# transfer the bundle to hostB, and continue:\nhostB$ git clone /path/to/hostA.bundle my-repo\n# you now have a clone, complete with remote branches and tags\n# just to make it a little more obvious, rename the remote:\nhostB$ git remote rename origin hostA\n\n# make some commits on hostB; time to transfer back to hostA\n# use the known master branch of hostA as a basis\nhostB$ git bundle create hostB.bundle ^hostA/master --branches --tags\n\n# copy the bundle back over to hostA and continue:\nhostA$ git remote add hostB /path/to/hostB.bundle\n# fetch all the refs from the remote (creating remote branches like hostB/master)\nhostA$ git fetch hostB\n# pull from hostB's master, for example\nhostA$ git pull\n\n# make some commits on hostA; time to transfer to hostB\n# again, use the known master branch as a basis\nhostA$ git bundle create hostA.bundle ^hostB/master --branches --tags\n# copy the bundle to hostB, **replacing** the original bundle\n# update all the refs\nhostB$ git fetch hostA\n\n# and so on and so on\n\nThe key thing to notice is that you can add a bundle as a remote, and interact with it just as you would with any other remote. To update that remote, just drop in a new bundle, replacing the previous one. \nI've also taken a slightly different approach to picking a basis. The man page uses tags, always kept up to date with the last refs which were transferred to the other host. I've simply used the remote branches, which will refer to the last refs transferred from the other host. It's a little bit inefficient; you'll end up bundling more than you need to, since it's one step behind. But flash drives are big, bundles are small, and using the refs you already have instead of having to take an extra step and be careful about tags saves a lot of effort.\nThe one thing that makes bundles a bit of trouble is that you can't push to them, and you can't \"rebase\" them. If you want the bundle based on a new basis, you have to recreate it. If you want new commits in it, you have to recreate it. This hassle gives rise to my next suggestion...\nRepo on a thumb drive\nHonestly, unless your repo is really big, this might be just as easy. Put a bare clone on a thumb drive, and you can push to and pull from it from both computers. Treat it like your network connection. Need to transfer to the central repo? Plug it in!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Clone only one branch [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I clone a single branch in Git?\n\n (27 answers)\n \n\nClosed 8 years ago.\n\n\n\nI would like to know how I could clone only one branch instead of cloning the whole Git repository."
},
{
"role": "assistant",
"content": "From the announcement Git 1.7.10 (April 2012):\n\n\ngit clone learned --single-branch option to limit cloning to a single branch (surprise!); tags that do not point into the history of the branch are not fetched.\n\n\nGit actually allows you to clone only one branch, for example:\ngit clone -b mybranch --single-branch git://sub.domain.com/repo.git\n\nNote: Also you can add another single branch or \"undo\" this action."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Auto-merging package-lock.json\n\ngit merge --no-ff account-creation\n\nAuto-merging package-lock.json\nCONFLICT (content): Merge conflict in package-lock.json\nAutomatic merge failed; fix conflicts and then commit the result.\nAny idea regarding this issue ?"
},
{
"role": "assistant",
"content": "As per the docs:\n\nResolving lockfile conflicts\nOccasionally, two separate npm install will create package locks that\ncause merge conflicts in source control systems. As of [email protected],\nthese conflicts can be resolved by manually fixing any package.json\nconflicts, and then running npm install [--package-lock-only] again.\nnpm will automatically resolve any conflicts for you and write a\nmerged package lock that includes all the dependencies from both\nbranches in a reasonable tree. If --package-lock-only is provided,\nit will do this without also modifying your local node_modules/.\nTo make this process seamless on git, consider installing\nnpm-merge-driver, which will\nteach git how to do this itself without any user interaction. In\nshort: $ npx npm-merge-driver install -g will let you do this, and\neven works with pre-[email protected] versions of npm 5, albeit a bit more\nnoisily. Note that if package.json itself conflicts, you will have\nto resolve that by hand and run npm install manually, even with the\nmerge driver."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository --depth=<depth>"
},
{
"role": "assistant",
"content": "Limit fetching to the specified number of commits from the tip of\neach remote branch history. If fetching to a shallow repository\ncreated by git clone with --depth=<depth> option (see git-clone ), deepen or shorten the history to the specified\nnumber of commits. Tags for the deepened commits are not fetched."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Can Git hook scripts be managed along with the repository?\nWe'd like to make a few basic hook scripts that we can all share -- for things like pre-formatting commit messages. Git has hook scripts for that that are normally stored under <project>/.git/hooks/. However, those scripts are not propagated when people do a clone and they are not version controlled. \nIs there a good way to help everyone get the right hook scripts? Can I just make those hook scripts point to version controlled scripts in my repo?"
},
{
"role": "assistant",
"content": "In Git 2.9, the \nconfiguration option core.hooksPath specifies a custom hooks directory.\nMove your hooks to a hooks tracked directory in your repository. Then, configure each instance of the repository to use the tracked hooks instead of $GIT_DIR/hooks:\ngit config core.hooksPath hooks\n\nIn general, the path may be absolute, or relative to the directory where the hooks are run (usually the working tree root; see DESCRIPTION section of man githooks)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to make git log cut long comments?\nI have a git log alias that prints each commit as a single line. Since some people write far too long one-liners in the commit log, many commits wrap to a new line. How can I format the git log output to cut the comment after 50 characters?\nI found this in the git-log man page but it will only pad short comments, not cut long ones.\n%<(<N>[,trunc|ltrunc|mtrunc]): make the next placeholder take at least N columns,\n padding spaces on the right if necessary. Optionally truncate at the beginning (ltrunc),\n the middle (mtrunc) or the end (trunc) if the output is longer than N columns. Note that\n truncating only works correctly with N >= 2."
},
{
"role": "assistant",
"content": "It is not that clear in the documentation just which characters are needed but the following example cuts the subject line to 50 characters:\ngit log --oneline --format=\"%h %<(50,trunc)%s\"\n\nThe format specification is %< and the arguments for that need to be in parentheses. In this case, 50 chars and truncate the excess.\nFor instance, performing this on the msysGit repository yields:\nC:\\src\\msysgit>git log -n 5 --format=\"%h [%<(12,trunc)%aN] [%<(12,trunc)%cN] %<(50,trunc)%s\"\n\n218ed04 [Sebastian ..] [Sebastian ..] Merge pull request #154 from csware/tortoisegitp..\n8a920b9 [Sven Stric..] [Sven Stric..] Installer: Detect TortoiseGitPlink from Tortoise..\n448e125 [dscho ] [dscho ] Merge pull request #152 from csware/syscommand\ndb8d1bf [Sven Stric..] [Sven Stric..] Perl readline creates empty sys$command files if..\n753d3d6 [Johannes S..] [Johannes S..] Git for Windows 1.8.5.2-preview20131230"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc"
},
{
"role": "assistant",
"content": "Combined diff format Any diff-generating command can take the -c or --cc option to\nproduce a combined diff when showing a merge. This is the default\nformat when showing merges with git-diff or git-show . Note also that you can give suitable --diff-merges option to any of these commands to force generation of\ndiffs in a specific format. A \"combined diff\" format looks like this: diff --combined describe.c\nindex fabadb8,cc95eb0..4866510\n--- a/describe.c\n+++ b/describe.c\n@@@ -98,20 -98,12 +98,20 @@@\n\treturn (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;\n }\n\n- static void describe(char *arg)\n -static void describe(struct commit *cmit, int last_one)\n++static void describe(char *arg, int last_one)\n {\n +\tunsigned char sha1[20];\n +\tstruct commit *cmit;\n\tstruct commit_list *list;\n\tstatic int initialized = 0;\n\tstruct commit_name *n;\n\n +\tif (get_sha1(arg, sha1) < 0)\n +\t\tusage(describe_usage);\n +\tcmit = lookup_commit_reference(sha1);\n +\tif (!cmit)\n +\t\tusage(describe_usage);\n +\n\tif (!initialized) {\n\t\tinitialized = 1;\n\t\tfor_each_ref(get_name); It is preceded by a \"git diff\" header, that looks like\nthis (when the -c option is used): diff --combined file or like this (when the --cc option is used): diff --cc file It is followed by one or more extended header lines\n(this example shows a merge with two parents): index <hash>,<hash>..<hash>\nmode <mode>,<mode>..<mode>\nnew file mode <mode>\ndeleted file mode <mode>,<mode> The mode <mode>,<mode>..<mode> line appears only if at least one of\nthe <mode> is different from the rest. Extended headers with\ninformation about detected content movement (renames and\ncopying detection) are designed to work with the diff of two\n<tree-ish> and are not used by combined diff format. It is followed by a two-line from-file/to-file header: --- a/file\n+++ b/file Similar to the two-line header for the traditional unified diff\nformat, /dev/null is used to signal created or deleted\nfiles. However, if the --combined-all-paths option is provided, instead of a\ntwo-line from-file/to-file, you get an N+1 line from-file/to-file header,\nwhere N is the number of parents in the merge commit: --- a/file\n--- a/file\n--- a/file\n+++ b/file This extended format can be useful if rename or copy detection is\nactive, to allow you to see the original name of the file in different\nparents. Chunk header format is modified to prevent people from\naccidentally feeding it to patch -p1 . Combined diff format\nwas created for review of merge commit changes, and was not\nmeant to be applied. The change is similar to the change in the\nextended index header: @@@ <from-file-range> <from-file-range> <to-file-range> @@@ There are (number of parents + 1) @ characters in the chunk\nheader for combined diff format. Unlike the traditional unified diff format, which shows two\nfiles A and B with a single column that has - (minus — appears in A but removed in B), + (plus — missing in A but\nadded to B), or \" \" (space — unchanged) prefix, this format\ncompares two or more files file1, file2,… with one file X, and\nshows how X differs from each of fileN. One column for each of\nfileN is prepended to the output line to note how X’s line is\ndifferent from it. A - character in the column N means that the line appears in\nfileN but it does not appear in the result. A + character\nin the column N means that the line appears in the result,\nand fileN does not have that line (in other words, the line was\nadded, from the point of view of that parent). In the above example output, the function signature was changed\nfrom both files (hence two - removals from both file1 and\nfile2, plus ++ to mean one line that was added does not appear\nin either file1 or file2). Also, eight other lines are the same\nfrom file1 but do not appear in file2 (hence prefixed with + ). When shown by git diff-tree -c , it compares the parents of a\nmerge commit with the merge result (i.e. file1..fileN are the\nparents). When shown by git diff-files -c , it compares the\ntwo unresolved merge parents with the working tree file\n(i.e. file1 is stage 2 aka \"our version\", file2 is stage 3 aka\n\"their version\")."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker <type>"
},
{
"role": "assistant",
"content": "Indicates that an object type is required.\nCurrently one of: blob , tree , commit , or tag ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I set up Eclipse/EGit with GitHub?\n\nI've never used Git before and would like to learn.\nI have a private repository with GitHub.\nI've installed the EGit plugin for Eclipse.\nI have a workspace where I do my work, generally: ~/Documents/workspace.\nI am able to add my GitHub repository and download it, but in doing so it creates ~/MyRepository.\nWhen I create a project, do I need to point it to ~/MyRepository?\nAlso, how come when I make an edit and I say push to upstream it says up to date?"
},
{
"role": "assistant",
"content": "Make sure your refs for pushing are correct. This tutorial is pretty great, right from the documentation:\nhttp://wiki.eclipse.org/EGit/User_Guide#GitHub_Tutorial\nYou can clone directly from GitHub, you choose where you clone that repository. And when you import that repository to Eclipse, you choose what refspec to push into upstream.\nClick on the Git Repository workspace view, and make sure your remote refs are valid. Make sure you are pointing to the right local branch and pushing to the correct remote branch."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git/GitHub can't push to master\nI am new to Git/GitHub and ran into an issue. I created a test project and added it to the local repository. Now I am trying to add files/project to the remote repository.\nHere's what I did (and this worked) -\ngit remote add origin git://github.com/my_user_name/my_repo.git\n\nNow when I try to push the repository to GitHub, using the following command, I get the following error -\ngit push origin master\n\nError -\nfatal: remote error:\nYou can't push to git://github.com/my_user_name/my_repo.git\nUse [email protected]:my_user_name/my_repo.git"
},
{
"role": "assistant",
"content": "GitHub doesn't support pushing over the Git protocol, which is indicated by your use of the URL beginning git://. As the error message says, if you want to push, you should use either the SSH URL [email protected]:my_user_name/my_repo.git or the \"smart HTTP\" protocol by using the https:// URL that GitHub shows you for your repository.\n(Update: to my surprise, some people apparently thought that by this I was suggesting that \"https\" means \"smart HTTP\", which I wasn't. Git used to have a \"dumb HTTP\" protocol which didn't allow pushing before the \"smart HTTP\" that GitHub uses was introduced - either could be used over either http or https. The differences between the transfer protocols used by Git are explained in the link below.)\nIf you want to change the URL of origin, you can just do:\ngit remote set-url origin [email protected]:my_user_name/my_repo.git\n\nor\ngit remote set-url origin https://github.com/my_user_name/my_repo.git\n\nMore information is available in 10.6 Git Internals - Transfer Protocols."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What determines default branch after \"git clone\"?\nMy understanding is that the default branch of a cloned repository is to be whatever HEAD points to in the repo being cloned.\nI now have a case where this is not true. My understanding is obviously flawed, so what does determine the default checkout branch when cloning a (bare) repo?\nThe last commit on that repo was a merge between the branch referenced in the bare repo's HEAD into the branch I'm getting as the checkout branch in the clone.\nRunning git remote show origin returns:\nFetch URL: ...\nPush URL: ...\nHEAD branch (remote HEAD is ambiguous, may be one of the following):\n <bad-branch>\n live\nRemote branches:\n ...\n\nBare repo uses Git version 1.8.2.1, client uses 1.7.12.4, transport is SSH.\nMaybe the answer is actually this one here. This answer confirms it. If there is a choice of symbolic refs all pointing to the same revision as HEAD, the client will guess which branch to use."
},
{
"role": "assistant",
"content": "Beginning with Git 1.8.5, the server will send the actual branch name that HEAD points to, in the \"symref\" capability. If you have both a client and server newer than Git 1.8.5, it will update HEAD correctly.\nPrior to that, the client will guess what HEAD may have pointed to by comparing the object ID that HEAD (ultimately) points to with all the object IDs of all the branches. It prefers a branch named refs/heads/master: if both HEAD and master point to the same object ID, then clone will set the default branch in the new repository to master.\nOtherwise, the first branch with a matching OID (when the branches are sorted alphanumerically) will be the default branch. If no branches have matching OIDs, then HEAD will be set directly to the object ID (ie, a detached HEAD)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --diff-merges=<format>"
},
{
"role": "assistant",
"content": "Specify diff format to be used for merge commits. Default is\n`dense-combined` unless --first-parent is in use, in\nwhich case first-parent is the default. The following formats are supported: off, none Disable output of diffs for merge commits. Useful to override\nimplied value. on, m Make diff output for merge commits to be shown in the default\nformat. The default format can be changed using log.diffMerges configuration variable, whose default value\nis separate . first-parent, 1 Show full diff with respect to first parent. This is the same\nformat as --patch produces for non-merge commits. separate Show full diff with respect to each of parents.\nSeparate log entry and diff is generated for each parent. combined, c Show differences from each of the parents to the merge\nresult simultaneously instead of showing pairwise diff between\na parent and the result one at a time. Furthermore, it lists\nonly files which were modified from all parents. dense-combined, cc Further compress output produced by --diff-merges=combined by omitting uninteresting hunks whose contents in the parents\nhave only two variants and the merge result picks one of them\nwithout modification. remerge, r Remerge two-parent merge commits to create a temporary tree\nobject—potentially containing files with conflict markers\nand such. A diff is then shown between that temporary tree\nand the actual merge commit. The output emitted when this option is used is subject to change, and\nso is its interaction with other options (unless explicitly\ndocumented)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I make Jenkins CI with Git trigger on pushes to master?\n\nI'm trying to set up Jenkins-ci for a project using GitHub. I've already set up Jenkins with the appropriate plugins. I want Jenkins to run build scripts only whenever someone on the project pushes to master. So far I've been able to set it up so that a build will be triggered anytime anyone pushes to anywhere, but that is too broad. I've done this with post-receive service hooks on Git.\nI've read the Jenkins wiki, and a couple of tutorials, but this particular detail is missing... is it something to do with polling maybe? Or should work be done on the Git side, so that Git only triggers Jenkins when master is changed?"
},
{
"role": "assistant",
"content": "As already noted by gezzed in his comment, meanwhile there is a good solution (described in Polling must die: triggering Jenkins builds from a Git hook):\n\nSet the Jenkins job's build trigger to Poll SCM, but do not specify a schedule.\nCreate a GitHub post-receive trigger to notify the URL\nhttp://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>?token=<get token from git to build remotely>\n\nThis will trigger all builds that poll the specified Git repository.\nHowever, polling actually checks whether anything has been pushed to the used branch.\n\nIt works perfectly."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --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": "git - the stupid content tracker GIT_ICASE_PATHSPECS"
},
{
"role": "assistant",
"content": "Setting this Boolean environment variable to true will cause Git to treat all\npathspecs as case-insensitive."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-init - Create an empty Git repository or reinitialize an existing one umask false"
},
{
"role": "assistant",
"content": "Use permissions reported by umask (2). The default, when --shared is not\nspecified."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-daemon - A really simple server for Git repositories --base-path-relaxed"
},
{
"role": "assistant",
"content": "If --base-path is enabled and repo lookup fails, with this option git daemon will attempt to lookup without prefixing the base path.\nThis is useful for switching to --base-path usage, while still\nallowing the old paths."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Revert a commit on remote branch\nI've worked on a local branch adding many commits.\nThen i've pushed it to the remote staging branch. \nNow I have to undo the last commit already pushed to remote staging that is the merge of my local branch to remote staging\nWhat I've understood looking on the other answers is that I have to use revert and not reset to do it in a clean way, isn't it?\nSo what I have to do is:\n\ncreate a new local branch called for example cleaning having master as parent (that is behind staging)\npull the remote staging into cleaning\nuse git revert {last good commit hash in staging}\nnow cleaning should be in the good commit and in the same state of remote staging before my bad push, isn't it?\nnow I should push cleaning into remote staging to having the remote branch reverted. With which flags?\n\nAm I correct? Because git status being at point 4 tells me that i'm up to date with staging"
},
{
"role": "assistant",
"content": "Don't make it complicated.\nFirst you need to do a git log to find out which commit ID you want to revert. For example it is commit abc123. If you know that it's the last one, you can use a special identifier \"HEAD\".\nThen you first revert it locally in your local \"staging\" branch:\ngit checkout staging\ngit revert abc123\n\nNote: for the last commit in the log you would write git revert HEAD.\nAnd then you update your remote \"staging\":\ngit push\n\nExplanation: In git if you have a remote you are dealing with 2 distinct repositories (local and remote). After you do git checkout staging, you actually create a distinct local name that represents the remote branch. git revert actually doesn't delete your commit, but it creates a new commit on top, that undoes all the changes (if you added a file - the new commit will remove it, if you removed a line - the new commit will add it back etc.), i.e. it is an addition to the log, that's why the push will be clean.\nIf you want to really make it gone, so that nobody can blame you, you can do at your risk:\ngit checkout staging\ngit reset --hard HEAD^\ngit push -f\n\n(the reset line retargets the local \"staging\" branch so that it points to a commit that is right before your top commit)\nIn general the forced push is a bad practice, but keeping useless commits and reverts around is not nice as well, so another solution would be to actually create a new branch \"staging2\" and do your testing in that branch instead:\ngit checkout staging\ngit checkout -b staging2\ngit reset --hard HEAD^\ngit push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How Do I Upload Eclipse Projects to GitHub?\nI have code in Eclipse that I'd like to upload to GitHub but so far I can't figure out how. It says \"create a repository\" but that looks more like a folder that holds your projects and I'm not sure how to upload my code to it. Apologies for the seemingly dumb question. Also, how does one delete repositories? Didn't see a way to do that either."
},
{
"role": "assistant",
"content": "While the EGit plugin for Eclipse is a good option, an even better one would be to learn to use git bash -- i.e., git from the command line. It isn't terribly difficult to learn the very basics of git, and it is often very beneficial to understand some basic operations before relying on a GUI to do it for you. But to answer your question:\nFirst things first, download git from http://git-scm.com/. Then go to http://github.com/ and create an account and repository.\nOn your machine, first you will need to navigate to the project folder using git bash. When you get there you do:\ngit init\n\nwhich initiates a new git repository in that directory.\nWhen you've done that, you need to register that new repo with a remote (where you'll upload -- push -- your files to), which in this case will be github. This assumes you have already created a github repository. You'll get the correct URL from your repo in GitHub.\ngit remote add origin https://github.com/[username]/[reponame].git\n\nYou need to add you existing files to your local commit:\ngit add . # this adds all the files\n\nThen you need to make an initial commit, so you do:\ngit commit -a -m \"Initial commit\" # this stages your files locally for commit. \n # they haven't actually been pushed yet\n\nNow you've created a commit in your local repo, but not in the remote one. To put it on the remote, you do the second line you posted:\ngit push -u origin --all"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I delete a remote branch in Git? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nHow do I delete a Git branch locally and remotely?\n\n (41 answers)\n \n\nClosed 6 years ago.\n\n\n\nI created a branch notmaster to commit as well as push some changes. When I was finished with that branch, I merged the changes back into master, pushed them out, and then deleted the local notmaster.\n$ git branch -a\n* master\n remotes/origin/master\n remotes/origin/notmaster\n\nIs there anyway to delete the remote notmaster?\n\nA little more clarity, with the solution from Ionut:\nThe usual method failed for me:\n$ git push origin :notmaster\nerror: dst refspec notmaster matches more than one.\n\nThat's because I had a tag with the same name as the branch. This was a poor choice on my behalf and caused the ambiguity. So in that case:\n$ git push origin :refs/heads/notmaster"
},
{
"role": "assistant",
"content": "git push origin :notmaster, which basically means \"push nothing to the notmaster remote\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git push all branches from one remote to another remote\n\nI have two remote: upstream and origin. upstream is something I can't push to. origin is my own repo. How can I fetch all branches from upstream and then push them to origin?\nI tried:\ngit fetch upstream\ngit push --all origin\n\nBut it doesn't work."
},
{
"role": "assistant",
"content": "I just needed to copy one repository from Bitbucket to GitHub, these are the steps assuming your remote is called origin, all branches and tags will be copied:\ngit remote add neworigin url-to-new-remote\ngit push neworigin --tags \"refs/remotes/origin/*:refs/heads/*\"\n\nGood thing about this is that files in your working copy won't be modified."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Running gitlab-ci pipeline jobs as non-root user\n\nI have a mvn project which must be build as an non-root user\nbut by default gitlab-ci allows runners to run as root user.\nI'm using gitlab.com runners by setting up gitlab-ci.yml file.\nI tried creating a user and switching to it like this:\n$ useradd ***\n$ su -***\n$ whoami\nroot\n\nIt still says I'm root.\nHow can I solve this?"
},
{
"role": "assistant",
"content": "You can easily achieve this with sudo, e.g.,\nexcerpt from my .gitlab-ci.yml:\nscript:\n - useradd -d /builds/{GITLAB_USER} -g users -M -N builder\n - chown -R builder:users ..\n - | \n sudo -H -i -u builder sh -e -x << EOS \n umask 0077 \n export CONTINUOUS_INTEGRATION_SYSTEM=\"gitlab\" TIMESTAMP=`date +%Y%m%d%H%M%S` DEFAULT_TARGET=\"debug\" \n export PREFIX=\"\\${HOME}/usr\" SYSCONFDIR=\"\\${HOME}/etc/conf\" LOCALSTATEDIR=\"\\${HOME}/var\" \n cd my-project \n make install \n make -C _deploy/debian clean package bundle BUILD_ID=\"-0{other}\\${TIMESTAMP}\" \n EOS\n\nWhere {GITLAB_USER} is your actual gitlab user.\nRemember to escape $ in your script"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-format-patch - Prepare patches for e-mail submission --[no-]signature=<signature>"
},
{
"role": "assistant",
"content": "Add a signature to each message produced. Per RFC 3676 the signature\nis separated from the body by a line with '-- ' on it. If the\nsignature option is omitted the signature defaults to the Git version\nnumber."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Make some files private in a repository\n\nI want to host the source code for a website I created in a public repository on Github. I want it to be public so that I can also show the source code to others, however there are some files that I want to remain private. Files that may contain passwords and such (like when connecting to databases). Is there a way to do that?"
},
{
"role": "assistant",
"content": "Although keeping passwords in the repository is a bad practice as @aspyct has explained, I want to add that not all things that one might want to keep private in a repository are passwords, e.g., one might want to develop a new feature but not expose it until it's done(or maybe expose it never).\nIn these cases, we can create two remote repositories both associated with the same local repository, but each corresponding to a different branch. Here's a step by step instruction:\n\nCreate two remote repositories(on GitHub or BitBucket or wherever else) with different names, for example: one myrepo and the other privates.myrepo. Make the myrepo a public repository and the privates.myrepo a private repository.\nOn local, initiate a single git repository: git init.\nAdd the non-private files now in the repository and make an initial commit.\nConnect this repository to the public remote:\n\ngit remote add <remote_branch_name> <remote_repository_address>\n\nin our example which becomes:\ngit remote add origin https://github.com/<YOUR_USERNAME>/myrepo.git\n\n\nPush: git push -u origin master\n\nNow add a branch to the local repository and switch to it: git checkout -b private_work\n\nHere comes the important step: Connect this branch to the other remote, i.e, the private one. In our example:\n\n\ngit remote add privates https://github.com/<YOUR_USERNAME>/privates.myrepo.git\n\n\nNext, add the private files to the local repository and make a commit.\nPush the private_work branch to the privates remote: git push -u privates private_work\n\n\nRead more explanation on how it works here: https://24ways.org/2013/keeping-parts-of-your-codebase-private-on-github/. I've also learned this from him.\nSee a cool terminal-show recording of all these steps together here: http://showterm.io/04130676d3401229e7df6\nAlso, you can add an alias like alias private_push='git push privates private_work in an startup script like .bashrc in case you're on Linux, in order to lower the chances of making a wrong push of private work to the public repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-cherry-pick"
},
{
"role": "assistant",
"content": "Apply the changes introduced by some existing commits"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to reset \"local\" git repository?\nI was trying to ignore some folders when pushing and ended up with only the .gitignore in the repository. Now want to \"reset\" my repository (by reset I mean to remove all the rules I applied and clean the commit area), so that I can add all my files and remove the folders I don't want after that. Any help?"
},
{
"role": "assistant",
"content": "You could just delete your .git folder and start again.\nrm -rf .git\ngit init\n\nThis will leave the current .gitignore in place, which would still be followed by the new git repo. The .gitignore could be removed, or delete the contents so it is a blank file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc dimmed-zebra"
},
{
"role": "assistant",
"content": "Similar to zebra , but additional dimming of uninteresting parts\nof moved code is performed. The bordering lines of two adjacent\nblocks are considered interesting, the rest is uninteresting. dimmed_zebra is a deprecated synonym."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Removing contributor from github.com?\n\nHow to remove contributor from showing in the main page of project:\n\nLink https://help.github.com/articles/removing-a-collaborator-from-a-personal-repository/ says it possible in settings, but I dont see any collaborator in there:"
},
{
"role": "assistant",
"content": "The below method works in my case at least.\n\nIn the GitHub web interface, change a branch name (From main to main1 for example). You can do that from the url https://github.com/[user]/[repo]/branches. It will update the contributor list on the repository dashboard.\n\n\nThen change the name back (main1 to main).\n\n\nI have multiple GitHub accounts for different projects and different communities and I accidentally pushed a commit using a wrong account. I changed the author of the commit, but the wrong account was still on the contributors list in the repository dashboard.\nMy method keeps the commit history as well as the GitHub action settings and issue history. But I did not check if pull requests are kept."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-fast-export"
},
{
"role": "assistant",
"content": "Git data exporter"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-bundle - Move objects and refs by archive unbundle <file>"
},
{
"role": "assistant",
"content": "Passes the objects in the bundle to git index-pack for storage in the repository, then prints the names of all\ndefined references. If a list of references is given, only\nreferences matching those in the list are printed. This command is\nreally plumbing, intended to be called only by git fetch .\nIf file is - , the bundle is read from stdin."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options transfer.advertiseSID"
},
{
"role": "assistant",
"content": "Boolean. When true, client and server processes will advertise their\nunique session IDs to their remote counterpart. Defaults to false."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I make git log order based on author's timestamp?\nI use a fairly complex git-log command involving --date-order to get an overview of my repository's status; but unfortunately, --date-order seems to use the committer date, not the author date. That means that each time I bring my topic branches up to date by rebasing them onto the current upstream, I lose the helpful chronological ordering in my git-log of relative commits in my topic branches (that is, each branch becomes a single long line, because all of its commits got rebased to sequential and nearly-identical committer timestamps.)\nIf I could get git-log to order commits by the author timestamp instead of the committer timestamp, this would be solved. Does anybody know of a way to do that?\n\nFor those visiting this from Google results, you may want to look into josephdpurcell's solution (and in-depth blog post!), below. It's quite excellent, if you're looking for standard git-log style output, multi-line, with detailed messages about each commit.\nUnfortunate, I now need to amend this question, because I'm an idiot and didn't provide more specific information about my use-case: I use git-log in “--graph mode,” and I need to make git-log itself operate in author-date-order. As far as I've been able to ascertain, this is completely impossible to do from outside git-log, because git-log itself handles the graph ordering and printing.\nA script, or patch for git-log, may be necessary, it seems. I'll leave this open until somebody can either 1. write such a script, or 2. we can talk the git authors into including a --author --date-order combination of flags. (=\n\nFor reference, here's what my current glog function's output looks like, and what I need to re-order:"
},
{
"role": "assistant",
"content": "git version 1.8.4 added an --author-date-order argument to git log; according to the release notes, \"the output is topologically sorted and commits in parallel histories are shown intermixed together based on the author timestamp.\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I shallow clone a repo on a specific branch?\nHow do I shallow clone a git repository, so that my clone contains only 1 history item, and starts on a specific branch?\nI know how to do a shallow clone:\ngit clone --depth 1 https://path/to/myrepo.git\n\nbut not start the clone on a specific branch."
},
{
"role": "assistant",
"content": "To clone repo foo.git with branch bar do:\ngit clone --depth 1 https://path/to/repo/foo.git -b bar\n\nSee the git-clone documentation: https://www.kernel.org/pub/software/scm/git/docs/git-clone.html"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cherry-pick - Apply the changes introduced by some existing commits --empty=(drop|keep|stop)"
},
{
"role": "assistant",
"content": "How to handle commits being cherry-picked that are redundant with\nchanges already in the current history. drop The commit will be dropped. keep The commit will be kept. Implies --allow-empty . stop The cherry-pick will stop when the commit is applied, allowing\nyou to examine the commit. This is the default behavior. Note that --empty=drop and --empty=stop only specify how to handle a\ncommit that was not initially empty, but rather became empty due to a previous\ncommit. Commits that were initially empty will still cause the cherry-pick to\nfail unless one of --empty=keep or --allow-empty are specified."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Having Gitlab Runner use node_modules as an artifact instead of in cache\n\nAccording to the GitLab Documentation for cache vs artifacts the node_modules should be stored as cache instead of an artifact. The issue with this is if there are multiple runners and a different runner from what created the \"build\" picks up a job then the cache (node_modules) won't exist which will fail the GitLab CI randomly (if the same runner happens to do the rest of the jobs then it will succeed).\nI could make it so everything is done in one job but once I have to put in deployment this issue will reoccur. Another option is to tag it so only one specific runner completes the job but I feel like that is slow.\nAfter researching I realized I could just put in node_modules as an artifact instead of the cache and it will be picked up no matter which runner runs the job but I can't find any documentation on if this is bad or not.\nSo is it okay to put node_modules as an artifact? If so, why wouldn't people put it as an artifact normally (assuming they add an expiration)?"
},
{
"role": "assistant",
"content": "The short answer here is that you can use the tool however you want to. You absolutely can use artifacts for node_modules. However, there's a way to make the cache work too.\nBy default, when a runner caches a file or directory, it stores it locally on the host running that runner (which is why it's not available on other runners). In the runner config however, you can change this to store cached objects in AWS S3 or an S3-like repo (like Minio). If all runners are configured this way, or at least 2 are, then those runners can also use the same cached items.\nYou can read about the runner's cache config options here: https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnerscache-section\nYou can read about Minio (an open source storage solution that provides an S3 API interface) here: https://docs.min.io/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git : empty ident name (for <>) not allowed\n\nI was applying a diff file of an opensource project on the top of my repository using git-am :\n git am -3 < /Downloads/refactorWork.diff\n\nbut it had conflicts and i had to resolve them; but after resolving the conflicts and staging them, when i did git am --continue i got :\nfatal : empty ident name (for <>) not allowed\n\nI looked up on the internet and found this which seemed to be similar to my problem but my usename and email were already added up in global and local git directories. Here is the output of git config list :\nrohan@~/Documents/libo : $ git config --global --list\n[email protected]\nuser.name=Rohan Kumar\nalias.l=log --oneline --graph --pretty\ncredential.helper=cache\n\nAlthough i solved this by first commiting the staged changes and then using git am --skip, I am interested in knowing what does that error means and whether what i did was the correct way of doing it, or is there any better way?"
},
{
"role": "assistant",
"content": "This diff file is a plain diff, not something generated by git format-patch. A format-patch generated diff contains information about the commit author, author date, commit message, ... and maintains this information when creating the commit(s).\nYour plain diff does not have these information, so git am will complain that it is missing, naturally.\nYou should instead have used git apply which is meant to apply simple patch files like you have in this case which will only apply the patch to the worktree (and index if you tell it to) but does not create any commit automatically."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Elegant solution to prevent force push on master only\n\nI'm trying to figure out a good way to prevent developers from force pushing master with Git. We used GitHub to host our remote repositories so a pre-receive hook isn't an option. Any other solutions that could easily be implemented for a team of developers?\nAs a side note, I don't want to disable force pushing in general. Sometimes it is a necessary evil. But that said, force pushing on master cannot happen."
},
{
"role": "assistant",
"content": "Update\nGithub has since introduced the concept of protected branches. It can be found under Settings -> Branches -> Protected Branches \nThis \"protection\" can be enabled for any branch, and for any user, including admins.\nMore details here - https://help.github.com/articles/defining-the-mergeability-of-pull-requests/\n\nYou cannot prevent this in Github.\nWhat you can do is have an intermediate repo on your side, run a pre-receive hook in that to prevent force push and push from this intermediate repo to github and block access for direct push to github. Yeah this is not elegant and you lose lots of features with Github, but I don't see any other way.\nEdit: Just came across this answer, which says the same and gives another workaround: GitHub - prevent collaborators from using push -f"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Pull Image from Gitlab Registry in Docker Compose File\n\nI want to deploy a docker stack on my own server. I've written a .gitlab-ci.yml file that currently builds the images in my stack and pushes them to my gitlab registry:\nbuild:\n stage: build\n image: docker:stable\n services: \n - docker:dind\n before_script:\n - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY\n - docker info\n script:\n - docker build -t $DOCKER_IMAGE1_TAG -f dir1/Dockerfile ./dir1\n - docker push $DOCKER_IMAGE1_TAG\n - docker build -t $DOCKER_IMAGE2_TAG -f dir2/Dockerfile ./dir2\n - docker push $DOCKER_IMAGE2_TAG \n\nI'm struggling for a way to run the docker deploy command on my own server with the docker-compose.yml file I've written, that successfully pulls the images from my gitlab registry. I figure I could use sshpass to ssh into my server and then copy the docker-compose.yml file across and run docker deploy from there, but I'm not sure what's the best way to allow my server to access the images now located in my gitlab registry:\n# Need to ssh into the server, transfer over docker-stack file and run docker swarm deploy\ndeploy:\n stage: deploy\n environment:\n name: production\n image: trion/ng-cli-karma\n before_script:\n - apt-get update -qq && apt-get install -y -qq sshpass\n - eval $(ssh-agent -s)\n\nThis is a section of my docker-compse file:\nversion: \"3.2\"\nservices:\n octeditor:\n image: image # how to set this to the image in my container registry?\n ports:\n - \"3000:3000\"\n networks:\n - front-tier\n deploy:\n replicas: 1\n update_config:\n parallelism: 1\n failure_action: rollback\n placement:\n constraints:\n - 'node.role == manager'\n restart_policy:\n condition: on-failure\n delay: 5s\n max_attempts: 3\n window: 120s\n\nHow can I pull the images from my gitlab registry? Is this the preferred way of creating a docker deployment on a remote server, via gitlab ci?"
},
{
"role": "assistant",
"content": "I equally had this difficulty recently, finally I found out that the solution is just to insert the link to the image in the private registry as is the case for me with gitlab.\nversion: \"3.2\"\nservices:\n octeditor:\n image: registry.gitlab.com/project-or-group/project-name/image-name:tag\n ports:\n - \"3000:3000\"\n networks:\n - front-tier"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What does it mean when Git diff shows mode changes?\nI'm trying to view changes for a single file that is unstaged.\nFirst I use git status to view all the unstaged changes then for example: \ngit diff AndroidManifest.xml\n\nBut I get this output:\ndiff --git a/AndroidManifest.xml b/AndroidManifest.xml \nold mode 100755 \nnew mode 100644\n\nWhat does that mean and how can I view changes for specific file?"
},
{
"role": "assistant",
"content": "Most probably, the contents of this file haven't changed, only the executable bit has been cleared. Try actually changing the file by, say, appending an empty line to it, and see what git diff outputs.\nApart from file contents, Git also records the state of the executable bit for each file. It makes sense on Linux systems if you want scripts to be executable right after checkout. See also the following two related questions:\nHow do I make Git ignore file mode (chmod) changes?\nHow do I remove files saying \"old mode 100755 new mode 100644\" from unstaged changes in Git?"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary file system"
},
{
"role": "assistant",
"content": "Linus Torvalds originally designed Git to be a user space file system,\ni.e. the infrastructure to hold files and directories. That ensured the\nefficiency and speed of Git."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Watch a page in gitlab wiki\n\nHow can I watch a page in gitlab wiki and receive notifications every time someone edit/modify the page. I already watch the project and receive notifications for commits, comments etc"
},
{
"role": "assistant",
"content": "I answer my own question after posting in Gital user group. \nIt is not possible to watch a page in Gitlab wiki. See link below\nhttps://groups.google.com/forum/#!msg/gitlabhq/v887P52tMXI/MqaCWztc7sAJ"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options sendemail.annotate sendemail.bcc sendemail.cc sendemail.ccCmd sendemail.chainReplyTo sendemail.envelopeSender sendemail.from sendemail.headerCmd sendemail.signedOffByCc sendemail.smtpPass sendemail.suppressCc sendemail.suppressFrom sendemail.to sendemail.toCmd sendemail.smtpDomain sendemail.smtpServer sendemail.smtpServerPort sendemail.smtpServerOption sendemail.smtpUser sendemail.thread sendemail.transferEncoding sendemail.validate sendemail.xmailer"
},
{
"role": "assistant",
"content": "These configuration variables all provide a default for git-send-email command-line options. See its\ndocumentation for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to restore a whole directory from history of git repository?\nI would like to restore a whole directory (recursively) from the history of my git repository.\nThere is only 1 branch (master).\nI know the commit where errors were included.\nCan I use the sha1 hash of the parent commit to restore the state of the directory as it was before the errors were included?\nI thought about something like this:\ngit checkout 348ce0aa02d3738e55ac9085080028b548e3d8d3 path/to/the/folder/\n\nbut it did not work."
},
{
"role": "assistant",
"content": "try adding '--' between revisions and paths:\ngit checkout 348ce0aa02d3738e55ac9085080028b548e3d8d3 -- path/to/the/folder/ \n\nAnd if you want to recover a directory from the previous commit, you can replace the commit hash by HEAD~1, for example:\ngit checkout HEAD~1 -- path/to/the/folder/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "githooks - Hooks used by Git"
},
{
"role": "assistant",
"content": "SYNOPSIS $GIT_DIR/hooks/* (or `git config core.hooksPath`/*)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-list - Lists commit objects in reverse chronological order --filter-print-omitted"
},
{
"role": "assistant",
"content": "Only useful with --filter= ; prints a list of the objects omitted\nby the filter. Object IDs are prefixed with a “~” character."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is there a way to make Github un-approve a pull request if a new commit is pushed to the branch?\n\nUsing the new pull request approval process in Github, if I approve a PR but then a dev pushes a new commit to that branch I'd want the PR to go back to the state it is in to start with (i.e. not approved).\nAt the moment it stays green but in reality there is code that hasn't been reviewed in the branch."
},
{
"role": "assistant",
"content": "On GitHub, navigate to the main page of the repository.\nUnder your repository name, click Settings.\nIn the left menu, click Branches.\nSelect the branch you want to restrict using the drop-down menu.\nSelect Dismiss stale pull request approvals when new commits are pushed. \n\nThis dismisses a pull request approval review when a code-modifying commit is pushed to the branch.\nClick Save changes.\nRef: https://help.github.com/articles/enabling-required-reviews-for-pull-requests/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Javascript Git client\nIs there a Javascript implementation of Git?\nI'm wanting to use HTML5 to create a rich Javascript application and have the idea that I could use git to track changes to the data. So, I'm wondering if there is a javascript implementation of a git client, or maybe some way of controlling a git repository by making POST requests."
},
{
"role": "assistant",
"content": "Check out: https://github.com/danlucraft/git.js\nA pure js implementation of git in javascript."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to find my GitHub username so that I can be found via the URL? [closed]\nClosed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.\n \n \n\n\n\n\n\n\n\n\n\n\n\n This question does not appear to be about programming within the scope defined in the help center.\n\n\nClosed 10 years ago.\n\n\n\n\n\n\n\n Improve this question\n \n\n\n\nI'm confused about my GitHub username\n\nIs it the one that is being displayed on the top right corner of the window?\nOr is it the one I created using \"git config --global user.name\" from my shell?\n\nI need to give it in a job application form."
},
{
"role": "assistant",
"content": "The one displayed in the top right corner in GitHub is your GitHub username - this is the one you use to login to GitHub when you enter the site and when you commit over HTTPS, and the one that appears in the URLs of your GitHub repositories.\nThe one you create using git config is your Git username - this is the one that appears as the author of your commits when you do git log or git blame.\nSince you can use Git outside of GitHub, those two usernames do not have to be the same. \nAlso, the GitHub username must be unique, but nothing forces uniqueness of Git usernames."
}
] |
[
{
"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": "DESCRIPTION This command shows the differences between two versions of a patch\nseries, or more generally, two commit ranges (ignoring merge commits). In the presence of <path> arguments, these commit ranges are limited\naccordingly. To that end, it first finds pairs of commits from both commit ranges\nthat correspond with each other. Two commits are said to correspond when\nthe diff between their patches (i.e. the author information, the commit\nmessage and the commit diff) is reasonably small compared to the\npatches' size. See ``Algorithm`` below for details. Finally, the list of matching commits is shown in the order of the\nsecond commit range, with unmatched commits being inserted just after\nall of their ancestors have been shown. There are three ways to specify the commit ranges: <range1> <range2> : Either commit range can be of the form <base>..<rev> , <rev>^! or <rev>^-<n> . See SPECIFYING RANGES in gitrevisions for more details. <rev1>...<rev2> . This is equivalent to <rev2>..<rev1> <rev1>..<rev2> . <base> <rev1> <rev2> : This is equivalent to <base>..<rev1>\n<base>..<rev2> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do you remove a tag from a remote repository\nIs it possible to untag a revision that has been push upstream using git.\nThis is what has happened:\ngit tag 1.1\ngit push --tags origin master\n\nDoh! That was meant to be version 1.1beta\nCan you rebase and repush upstream. No other member of my team has pulled from origin yet."
},
{
"role": "assistant",
"content": "You can delete a remote tag the same way that you delete a remote branch.\ngit push origin :1.1\n\nAnd delete your local tag with:\ngit tag -d 1.1"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Track all remote Git branches as local branches\nTracking a single remote branch as a local branch is straightforward enough.\ngit checkout --track -b ${branch_name} origin/${branch_name}\n\nPushing all local branches up to the remote, creating new remote branches as needed is also easy.\ngit push --all origin\n\nI want to do the reverse. If I have X number of remote branches at a single source:\ngit branch -r\n\nOutput:\nbranch1\nbranch2\nbranch3\n.\n.\n.\n\nCan I create local tracking branches for all those remote branches without needed to manually create each one? Say something like:\ngit checkout --track -b --all origin\n\nI've googled and read the manuals, but have come up bunk thus far."
},
{
"role": "assistant",
"content": "The answer given by Otto is good, but all the created branches will have \"origin/\" as the start of the name. If you just want the last part (after the last /) to be your resulting branch names, use this:\nfor remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote ; done\n\nIt also has the benefit of not giving you any warnings about ambiguous refs."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git rm --cached file vs git reset file\nI'm trying to learn Git. I'm confused between \ngit rm --cached file\n\nand\ngit reset file\n\nboth of the commands seem to take the file from staged to un-staged area. How do the commands differ?"
},
{
"role": "assistant",
"content": "git rm --cached <file> will completely remove the file's contents from the index. This means that on commit the file will be removed from the HEAD commit. (If the file was only added to the index and not yet tracked this is a \"no-op\".)\ngit reset -- <file> resets the contents of the file in the index to be the same as the head commit. This means that on commit no changes will be committed to the file. This operation is not valid if there is no tracked version of the file in the HEAD commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-hash-object - Compute object ID and optionally create an object from a file --stdin"
},
{
"role": "assistant",
"content": "Read the object from standard input instead of from a file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options pack.useBitmapBoundaryTraversal"
},
{
"role": "assistant",
"content": "When true, Git will use an experimental algorithm for computing\nreachability queries with bitmaps. Instead of building up\ncomplete bitmaps for all of the negated tips and then OR-ing\nthem together, consider negated tips with existing bitmaps as\nadditive (i.e. OR-ing them into the result if they exist,\nignoring them otherwise), and build up a bitmap at the boundary\ninstead. When using this algorithm, Git may include too many objects as a result\nof not opening up trees belonging to certain UNINTERESTING commits. This\ninexactness matches the non-bitmap traversal algorithm. In many cases, this can provide a speed-up over the exact algorithm,\nparticularly when there is poor bitmap coverage of the negated side of\nthe query."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Xcode and Git Source Control : “The working copy XXXXX failed to commit files”\nI have been using Xcode to develop and publish apps for almost a year. I have been using git as the local repository and bitbucket as the remote repository. Everything has been going fine until this morning. I am now getting an error 'The working copy \"xxx\" failed to commit files. Please tell me who you are.' Xcode then suggests that I run git config and give it an email address and name. \nI have no idea why it suddenly needs to know who I am. I don't know who it thought I was before and I don't want it to become more confused than it is now. I have not done anything with command prompts on the Mac so I am not sure where it expects me to enter this information. I vaguely recalled seeing suggestions on using the command prompt to set up bitbucket a year ago but they looked confusing so I did everything from the xcode GUI.\nIs this something new in xcode 4.6? What do I do?"
},
{
"role": "assistant",
"content": "I was getting this also. at first I could restart the mac and everything was working fine. Eventually though the problem came back with a vengeance even with a restart it would not let me commit so I had to do the command line loving. one caveat being that you have to type xcrun before any git commands in terminal when using vanilla git installed with Xcode.\nso type:\nxcrun git config --global user.email [email protected]\nxcrun git config --global user.name \"your name\"\n\nafter doing this everything was fine and dandy."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab CI CD variable are not getting injected while running gitlab pipeline\n\nI am running the below code section in gitlab-ci.yml file:\n script:\n- pip install --upgrade pip\n- cd ./TestAutomation\n- pip install -r ./requirements.txt\n\nBelow are the keys and values. So I have to pass any values to the pipeline with key as a variable\nENV : dev\nI have added all the above three variables in the GitLab CI CD variables sections by expanding them. just added a single value along with key\nI also found like we can add variables in the .yml file itself as below. I am not sure how we can add multiple values for one key\nvariables:\n TEST:\n value: \"some value\" # this would be the default value\n description: \"This variable makes cakes delicious\"\n\nWhen I run the pipeline I am getting errors as looks like these variables and values are not injected properly.\nMore details:\nAnd the same error I am getting while running the pipeline. Hence my suspect is like Category variable is not injected properly when I am running through the pipeline\nIf needed I will show it on the share screen\nWhat I have observed is --the values associated with keys which I am passing as parameter or variables , those are not injected or replaced instead of key. So ideally ${Category} should be replaced with value smoke etc"
},
{
"role": "assistant",
"content": "When Gitlab CI CD variables are not getting injected into your pipelines as environment variables, please follow the following steps to verify.\n\nCheck whether the variable is defined. You need to have at least the Maintainer role setup for your user. Go to Settings --> CI/CD --> Variables. You can see all project variables, and group variables (inherited).\n\nNext, check whether these variables are defined as Protected variables. If they are marked as Protected, then they are only exposed to protected branches or protected tags. I would suggest to uncheck this, if your current branch is not a protected branch. If not you can always make your current branch a protected one.\n\n\nNext, check whether your code is accessing the environment variables correctly. Based on your scripting language, just access as if you are accessing a regular environment variable.\n\nYou don't really need to define these variables in the .gitlab-ci.yaml file. (Even though their documentation says so)\n\n\nHope this helps."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I connect to my existing Git repository using Visual Studio Code?\n\nI've been using Visual Studio code for a long time, since v0.9.1. I now have run into the need to use GitHub and an online Git repository.\nI have the online Git repository set up and have been pushing changing to the online repository using GitHub. I have recently come to realize I can save myself a step with using Visual Studio Code to do both: to edit my code, then send it up to the online repository.\nI am very new to the whole Git concept. Visual Studio Code had me install the \"Git\" plugin which installed Git Bash, Git CMD, and Git GUI.\nThis is the online repository URL I'm trying to get to: https://github.com/SpectrumGraphics/Spectrum-Graphic-Designs.git"
},
{
"role": "assistant",
"content": "Open Visual Studio Code terminal (Ctrl + `)\nWrite the Git clone command. For example,\ngit clone https://github.com/angular/angular-phonecat.git\n\nOpen the folder you have just cloned (menu File → Open Folder)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "can't download github project with curl command\n\nI used \"curl -sO\" command to download project files from this GitHub project link:\nhttp://github.com/ziyaddin/xampp/archive/master.zip\nbut, I couldn't download. There is error occured and says that:\nArchive: /home/ziyaddin/Desktop/master.zip\n[/home/ziyaddin/Desktop/master.zip] End-of-central-directory\nsignature not found. Either this file is not a zipfile, or it\nconstitutes one disk of a multi-part archive. In the latter case\nthe central directory and zipfile comment will be found on the last\ndisk(s) of this archive. zipinfo: cannot find zipfile directory in\none of /home/ziyaddin/Desktop/master.zip or\n /home/ziyaddin/Desktop/master.zip.zip, and cannot find \n/home/ziyaddin/Desktop/master.zip.ZIP, period.\n\nbut I can download this link with curl command:\nhttp://cloud.github.com/downloads/pivotal/jasmine/jasmine-standalone-1.3.1.zip\nI think that it is because it is in cloud.github.com. I want to know how can I download from first link with curl command?"
},
{
"role": "assistant",
"content": "curl -L -O https://github.com/ziyaddin/xampp/archive/master.zip\n\n\nyou must use https://\nyou must use -L to follow redirects"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-reset - Reset current HEAD to the specified state --refresh --no-refresh"
},
{
"role": "assistant",
"content": "Refresh the index after a mixed reset. Enabled by default."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "IntelliJ commit 50-character line length reminder\nWhen committing a change on the IntelliJ platform, is there a way to have it check that the first line of the commit message does not exceed the 50-character length limit? \nRight now, I'm usually checking this manually, with the position indicator in the lower right corner of the main IDE window (the one that is formatted as line:character). However that indicator is sometimes hidden by other tool windows, and requires me to have the cursor at the end of the first line. Is there some setting I can enable or some plugin I can install to have the IDE check this for me?"
},
{
"role": "assistant",
"content": "For anyone still interested in this: I've come across a new setting which does allow what I initially wanted, in a settings group called 'Commit Dialog'.\n\nYou can now have it warn you about a long subject line right in the dialog, without needing the visual aid of a delimiter!"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fast-import - Backend for fast Git data importers"
},
{
"role": "assistant",
"content": "CRASH REPORTS If fast-import is supplied invalid input it will terminate with a\nnon-zero exit status and create a crash report in the top level of\nthe Git repository it was importing into. Crash reports contain\na snapshot of the internal fast-import state as well as the most\nrecent commands that lead up to the crash. All recent commands (including stream comments, file changes and\nprogress commands) are shown in the command history within the crash\nreport, but raw file data and commit messages are excluded from the\ncrash report. This exclusion saves space within the report file\nand reduces the amount of buffering that fast-import must perform\nduring execution. After writing a crash report fast-import will close the current\npackfile and export the marks table. This allows the frontend\ndeveloper to inspect the repository state and resume the import from\nthe point where it crashed. The modified branches and tags are not\nupdated during a crash, as the import did not complete successfully.\nBranch and tag information can be found in the crash report and\nmust be applied manually if the update is needed. An example crash: $ cat >in <<END_OF_INPUT\n# my very first test commit\ncommit refs/heads/master\ncommitter Shawn O. Pearce <spearce> 19283 -0400\n# who is that guy anyway?\ndata <<EOF\nthis is my commit\nEOF\nM 644 inline .gitignore\ndata <<EOF\n.gitignore\nEOF\nM 777 inline bob\nEND_OF_INPUT $ git fast-import <in\nfatal: Corrupt mode: M 777 inline bob\nfast-import: dumping crash report to .git/fast_import_crash_8434 $ cat .git/fast_import_crash_8434\nfast-import crash report:\n fast-import process: 8434\n parent process : 1391\n at Sat Sep 1 00:58:12 2007 fatal: Corrupt mode: M 777 inline bob Most Recent Commands Before Crash\n---------------------------------\n # my very first test commit\n commit refs/heads/master\n committer Shawn O. Pearce <spearce> 19283 -0400\n # who is that guy anyway?\n data <<EOF\n M 644 inline .gitignore\n data <<EOF\n* M 777 inline bob Active Branch LRU\n-----------------\n active_branches = 1 cur, 5 max pos clock name\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n 1) 0 refs/heads/master Inactive Branches\n-----------------\nrefs/heads/master:\n status : active loaded dirty\n tip commit : 0000000000000000000000000000000000000000\n old tree : 0000000000000000000000000000000000000000\n cur tree : 0000000000000000000000000000000000000000\n commit clock: 0\n last pack : -------------------\nEND OF CRASH REPORT"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options versionsort.prereleaseSuffix (deprecated)"
},
{
"role": "assistant",
"content": "Deprecated alias for versionsort.suffix . Ignored if versionsort.suffix is set."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub authentication failing over https, returning wrong email address\n\nInitiating a push or any other action with GitHub from the command line (over https, not ssh) that calls for the username and password not only fails but, when it does, it returns \nUsername for 'https://github.com': username\nPassword for 'https://[email protected]': \nremote: Invalid username or password.\nfatal: Authentication failed for 'https://github.com/username/repository.git/'\n\nI do not have an @github.com address. The password and username are correct.\nI know I could switch to SSH and use keys but that doesn't answer why the authentication is failing over https."
},
{
"role": "assistant",
"content": "GitHub's support determined the root of the issue right away: Two-factor authorization.\nTo use GitHub over the shell with https, create an OAuth token. As the page notes, I did have to remove my username and password credentials from Keychain but with osx-keychain in place, the token is stored as the password and things work exactly as they would over https without two-factor authorization in place."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-reset - Reset current HEAD to the specified state Split a commit apart into a sequence of commits"
},
{
"role": "assistant",
"content": "Suppose that you have created lots of logically separate changes and committed\nthem together. Then, later you decide that it might be better to have each\nlogical chunk associated with its own commit. You can use git reset to rewind\nhistory without changing the contents of your local files, and then successively\nuse git add -p to interactively select which hunks to include into each commit,\nusing git commit -c to pre-populate the commit message. $ git reset -N HEAD^ (1) $ git add -p (2) $ git diff --cached (3) $ git commit -c HEAD@{1} (4) ... (5) $ git add ... (6) $ git diff --cached (7) $ git commit ... (8) First, reset the history back one commit so that we remove the original\ncommit, but leave the working tree with all the changes. The -N ensures\nthat any new files added with HEAD are still marked so that git add -p will find them. Next, we interactively select diff hunks to add using the git add -p facility. This will ask you about each diff hunk in sequence and you can\nuse simple commands such as \"yes, include this\", \"No don’t include this\"\nor even the very powerful \"edit\" facility. Once satisfied with the hunks you want to include, you should verify what\nhas been prepared for the first commit by using git diff --cached . This\nshows all the changes that have been moved into the index and are about\nto be committed. Next, commit the changes stored in the index. The -c option specifies to\npre-populate the commit message from the original message that you started\nwith in the first commit. This is helpful to avoid retyping it. The HEAD@{1} is a special notation for the commit that HEAD used to be at\nprior to the original reset commit (1 change ago).\nSee git-reflog for more details. You may also use any other\nvalid commit reference. You can repeat steps 2-4 multiple times to break the original code into\nany number of commits. Now you’ve split out many of the changes into their own commits, and might\nno longer use the patch mode of git add , in order to select all remaining\nuncommitted changes. Once again, check to verify that you’ve included what you want to. You may\nalso wish to verify that git diff doesn’t show any remaining changes to be\ncommitted later. And finally create the final commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to use gitignore command in git\nI'm working first time on git. I have pushed my branch on github and it pushed all the library and documents into the github. Now what can I do and how can I use gitignore command to avoid the same mistake again."
},
{
"role": "assistant",
"content": "So based on what you said, these files are libraries/documentation you don't want to delete but also don't want to push to github. Let say you have your project in folder your_project and a doc directory: your_project/doc.\n\nRemove it from the project directory (without actually deleting it):\ngit rm --cached doc/* \nIf you don't already have a .gitignore, you can make one right inside of your project folder: project/.gitignore. \nPut doc/* in the .gitignore \nStage the file to commit: git add project/.gitignore\nCommit: git commit -m \"message\". \nPush your change to github."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --name-only"
},
{
"role": "assistant",
"content": "Show only names of changed files. The file names are often encoded in UTF-8.\nFor more information see the discussion about encoding in the git-log manual page."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --until=<date> --before=<date>"
},
{
"role": "assistant",
"content": "Show commits older than a specific date."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access\nH!\nI installed LFS in my github repository to track my *.csv files but when someone else tried to upload other csv and I wanted to make the pull of my repository this was the result\nThis repository is over its data quota. Account responsible for\nLFS bandwidth should purchase more data packs to restore access.\n\nMy question is How can I recover the access to my repository, it doesn´t matter if I can not use anymore LFS I will move my csv files to other place, I just want to recover the access to my github repository and being able to push and pull."
},
{
"role": "assistant",
"content": "Go to your repo settings.\nScroll down to the archives section.\nCheck on the checkbox of Include Git LFS objects in archives.\nThen try to push from locally again."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Specify extras_require with pip install -e\nHow can one manage to install extras_requires with pip when installing from a git repository ?\nI know that you can do pip install project[extra] when the project is on pypi.\nAnd you have to do pip install -e git+https://github.com/user/project.git#egg=project for a git repo but I didn't manage to find how to link these two options together."
},
{
"role": "assistant",
"content": "This should work, per examples #6 and #7\nFor remote repos:\npip install -e git+https://github.com/user/project.git#egg=project[extra]\n\nAnd this for local ones (thanks to @Kurt-Bourbaki):\npip install -e .[extra]\n\n\nAs per @Kurt-Bourbaki:\nIf you are using zsh you need to escape square brackets or use quotes:\npip install -e .\\[extra\\]\n# or\npip install -e \".[extra]\"\n\nAs per @Epoc:\nWindows Powershell will also require quoting the brackets."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-reset - Reset current HEAD to the specified state Undo a commit and redo"
},
{
"role": "assistant",
"content": "$ git commit ...\n$ git reset --soft HEAD^ (1) $ edit (2) $ git commit -a -c ORIG_HEAD (3) This is most often done when you remembered what you\njust committed is incomplete, or you misspelled your commit\nmessage, or both. Leaves working tree as it was before \"reset\". Make corrections to working tree files. \"reset\" copies the old head to .git/ORIG_HEAD ; redo the\ncommit by starting with its log message. If you do not need to\nedit the message further, you can give -C option instead. See also the --amend option to git-commit ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git rebase fatal: Needed a single revision\n\nI have a branch of a public repository and I am trying to update my branch with the current commits from the original repository:\n$ git fetch <remote>\nremote: Counting objects: 24, done.\nremote: Compressing objects: 100% (20/20), done.\nremote: Total 20 (delta 12), reused 0 (delta 0)\nUnpacking objects: 100% (20/20), done.\nFrom git://github.com/path_to/repo\n 9b70165..22127d0 master -> $/master\n$ git rebase <remote>\nfatal: Needed a single revision\ninvalid upstream <remote>\n\nThe <remote> is in place of my remote name and is not actually my remote name. The documentation on this error seems to be a bit loose."
},
{
"role": "assistant",
"content": "You need to provide the name of a branch (or other commit identifier), not the name of a remote to git rebase.\nE.g.:\ngit rebase origin/master\n\nnot:\ngit rebase origin\n\nNote, although origin should resolve to the the ref origin/HEAD when used as an argument where a commit reference is required, it seems that not every repository gains such a reference so it may not (and in your case doesn't) work. It pays to be explicit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Which files or folders should be in .gitignore in React project?\nI am making a react project and using Linux mint in Laptop and Windows 10 desktop. I would like to know, which files or folders should I keep in .gitignore so that I don't have to clean cache and install npm whenever I switch computers."
},
{
"role": "assistant",
"content": "Why bother? Just point your browser to gitignore.io and select all the tools and technologies you are using. You will automatically have a generated .gitignore file."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --default-prefix"
},
{
"role": "assistant",
"content": "Use the default source and destination prefixes (\"a/\" and \"b/\").\nThis overrides configuration variables such as diff.noprefix , diff.srcPrefix , diff.dstPrefix , and diff.mnemonicPrefix (see git-config (1))."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects -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": "fatal: 'origin' does not appear to be a git repository\n\nI've a repository moodle on my Github account which I forked from the official repository.\nI then cloned it on my local machine. It worked fine. I created several branches (under the master branch). I made several commits and it worked fine. \nI don't know how I'm getting the following error when I do : git push origin master\nfatal: 'origin' does not appear to be a git repository\nfatal: The remote end hung up unexpectedly\n\nHow do I resolve the error without effecting my repository on Github?\nI'm using Ubuntu 12.10\nThe contents of my .git/config after doing cat $(git rev-parse --show-toplevel)/.git/config gives:\n[core]\n repositoryformatversion = 0\n filemode = true\n bare = false\n logallrefupdates = true\n[branch \"master\"]\n[branch \"MOODLE_23_STABLE\"]\n[branch \"MOODLE_24_STABLE\"]\n[remote \"upstream\"]\n url = git://git.moodle.org/moodle.git\n fetch = +refs/heads/*:refs/remotes/upstream/*"
},
{
"role": "assistant",
"content": "$HOME/.gitconfig is your global config for git.\nThere are three levels of config files.\n cat $(git rev-parse --show-toplevel)/.git/config\n\n(mentioned by bereal) is your local config, local to the repo you have cloned.\nyou can also type from within your repo:\ngit remote -v\n\nAnd see if there is any remote named 'origin' listed in it.\nIf not, if that remote (which is created by default when cloning a repo) is missing, you can add it again:\ngit remote add origin url/to/your/fork\n\n\nThe OP mentions:\n\nDoing git remote -v gives: \n\nupstream git://git.moodle.org/moodle.git (fetch) \nupstream git://git.moodle.org/moodle.git (push)\n\nSo 'origin' is missing: the reference to your fork.\nSee \"What is the difference between origin and upstream in github\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Pass an argument to a Git alias command\nCan I pass arguments to the alias of a Git command?\nI have some alias in Git config, like so:\nrb1 = rebase -i HEAD~1\nrb2 = rebase -i HEAD~2\nrb3 = rebase -i HEAD~3\nrb4 = rebase -i HEAD~4\n....\n\nIs it possible to make an rb alias so that git rb <x> works for any <x>?\nI tried this alias:\nrb = rebase -i HEAD~\n\nbut then for instance git rb 8 does not work."
},
{
"role": "assistant",
"content": "If you consider the Git Faq section \"Git Aliases with argument\", you could do it, but by calling git through a shell:\n[alias]\n rb = \"!sh -c \\\"git rebase -i HEAD~$1\\\" -\"\n\nI haven't tested it yet, but if you can pass an argument, that would be the way to do it. \nA similar solution would be to use a shell function:\n[alias]\n rb = \"!f() { git rebase -i HEAD~$1; }; f\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --line-prefix=<prefix>"
},
{
"role": "assistant",
"content": "Prepend an additional prefix to every line of output."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Partly cherry-picking a commit with Git\nI'm working on 2 different branches: release and development. \nI noticed I still need to integrate some changes that were committed to the release branch back into the development branch. \nThe problem is I don't need all of the commit, only some hunks in certain files, so a simple \ngit cherry-pick bc66559\n\ndoes not do the trick. \nWhen I do a\ngit show bc66559\n\nI can see the diff but don't really know a good way of applying that partially to my current working tree."
},
{
"role": "assistant",
"content": "The core thing you're going to want here is git add -p (-p is a synonym for --patch). This provides an interactive way to add in content, letting you decide whether each hunk should go in or not, and even letting you manually edit the patch if necessary.\nTo use it in combination with cherry-pick:\ngit cherry-pick -n <commit> # get your patch, but don't commit (-n = --no-commit)\ngit reset # unstage the changes from the cherry-picked commit\ngit add -p # make all your choices (add the changes you do want)\ngit commit # make the commit!\n\n(Thanks to Tim Henigan for reminding me that git-cherry-pick has a --no-commit option, and thanks to Felix Rabe for pointing out that you need to git reset. If you only want to leave a few things out of the commit, you could use git reset <path>... to unstage just those files.)\nYou can provide specific paths to add -p if necessary. If you're starting with a patch you could replace the cherry-pick with apply.\n\nIf you really want to git cherry-pick -p <commit> (that option does not exist), you can use\ngit checkout -p <commit>\n\nThat will diff the current commit against the commit you specify, and allow you to apply hunks from that diff individually. This option may be more useful if the commit you're pulling in has merge conflicts in part of the commit you're not interested in. (Note, however, that checkout differs from cherry-pick: checkout tries to apply <commit>'s contents entirely, while cherry-pick applies the diff of the specified commit from it's parent. This means that checkout can apply more than just that commit, which might be more than you want.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker --list-cmds=<group>[,<group>…]"
},
{
"role": "assistant",
"content": "List commands by group. This is an internal/experimental\noption and may change or be removed in the future. Supported\ngroups are: builtins, parseopt (builtin commands that use\nparse-options), main (all commands in libexec directory),\nothers (all other commands in $PATH that have git- prefix),\nlist-<category> (see categories in command-list.txt),\nnohelpers (exclude helper commands), alias and config\n(retrieve command list from config variable completion.commands)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cat-file - Provide contents or details of repository objects -e"
},
{
"role": "assistant",
"content": "Exit with zero status if <object> exists and is a valid\nobject. If <object> is of an invalid format, exit with non-zero\nstatus and emit an error on stderr."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository fetch.negotiationAlgorithm"
},
{
"role": "assistant",
"content": "Control how information about the commits in the local repository\nis sent when negotiating the contents of the packfile to be sent by\nthe server. Set to \"consecutive\" to use an algorithm that walks\nover consecutive commits checking each one. Set to \"skipping\" to\nuse an algorithm that skips commits in an effort to converge\nfaster, but may result in a larger-than-necessary packfile; or set\nto \"noop\" to not send any information at all, which will almost\ncertainly result in a larger-than-necessary packfile, but will skip\nthe negotiation step. Set to \"default\" to override settings made\npreviously and use the default behaviour. The default is normally\n\"consecutive\", but if feature.experimental is true, then the\ndefault is \"skipping\". Unknown values will cause git fetch to\nerror out. See also the --negotiate-only and --negotiation-tip options to git-fetch ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %GK"
},
{
"role": "assistant",
"content": "show the key used to sign a signed commit"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker gitmodules"
},
{
"role": "assistant",
"content": "Defining submodule properties"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to get back to the latest commit after checking out a previous commit?\nI sometimes check out some previous version of the code to examine or test. I have seen instructions on what to do if I wish to modify previous commits -- but suppose I make no changes. After I've done e.g. git checkout HEAD^, how do I get back to the tip of the branch?.. git log no longer shows me the SHA of the latest commit."
},
{
"role": "assistant",
"content": "If you know the commit you want to return to is the head of some branch, or is tagged, then you can just\ngit checkout branchname\n\nYou can also use git reflog to see what other commits your HEAD (or any other ref) has pointed to in the past.\n\nEdited to add:\nIn newer versions of Git, if you only ran git checkout or something else to move your HEAD once, you can also do \ngit checkout -\n\nto switch back to wherever it was before the last checkout. This was motivated by the analogy to the shell idiom cd - to go back to whatever working directory one was previously in."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I view an old version of a file with Git?\nIs there a command in Git to see (either dumped to stdout, or in $PAGER or $EDITOR) a particular version of a particular file?"
},
{
"role": "assistant",
"content": "You can use git show with a path from the root of the repository (./ or ../ for relative pathing):\n$ git show REVISION:path/to/file\n\nReplace REVISION with your actual revision (a Git commit SHA, tag name, branch name, relative commit name, or any other way of identifying a commit in Git).\nFor example, to view the version of file <repository-root>/src/main.c from 4 commits ago, use:\n$ git show HEAD~4:src/main.c\n\nGit for Windows requires forward slashes even in paths relative to the current directory. For more information, check out the man page for git-show."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "SSH Host Key Verification Failed inside GitLab CI\n\nLocal Setup\nI created a public and private SSH key via the ssh-keygen command.\nI decided to setup the private key locally first, before setting it up on my repo's gitlab CI.\nI setup the public key on the server (in this case, another gitlab repo, but this may change in the future and shouldn't affect the question).\nI successfully communicated with the server locally via the following command (in this case I am using SSH via git, but this again may change in the future):\ngit clone [email protected]:...../......git\n\nGitLab CI Setup\nI then decided to setup the private key and communication on gitlab CI.\nInside my repo, I navigated to Settings -> Continuous Integration -> Variables, and added the following environment variables:\n\nSSH_DEPLOY_PRIVATE_KEY - I used to same private key that I used locally\nSSH_KNOWN_HOSTS\n\nI took the gitlab.com known host from my local computer's ~/.ssh/known_hosts file\ngitlab.com,35.231.145.151 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY=\n\n\nI then setup the SSH inside .gitlab-ci.yml:\nscript:\n - apt-get install openssh-client -y\n - eval $(ssh-agent -s)\n - echo \"$SSH_DEPLOY_PRIVATE_KEY\" | tr -d '\\r' | ssh-add - > /dev/null\n - mkdir -p /.ssh && touch /.ssh/known_hosts\n - echo \"$SSH_KNOWN_HOSTS\" >> /.ssh/known_hosts\n - mkdir -p ~/.ssh\n - chmod 700 ~/.ssh\n\nThis seemed to work fine and I got the following message: Identity added: (stdin) (runner@....)\nI then added the same git clone command to communicate with the server, and it failed with the following error:\nCloning into '......'...\nHost key verification failed.\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nTesting locally still works. I used the same commands above to setup the SSH locally (except I used pacman -S openssh to install instead).\nHow do I fix this?\nEdit\nI'm aware that I can execute ssh-keyscan directly in the GitLab CI and this should in theory solve the problem, but from what I know, this is susceptible to man-in-the-middle attacks. I'm trying to find a more secure solution.\nEdit 2\nAfter running ssh-keyscan directly in the GitLab CI, I get the same error message.\nVerbose output is the same:\n$ GIT_SSH_COMMAND=\"ssh -vvv\" git clone [email protected]:..../.....git deployed\nCloning into 'deployed'...\nHost key verification failed.\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nEdit 3\nSeems to be connected to the internet. Plus apt-get install wouldn't work otherwise.\n\nEdit 4\nI don't understand why this is such a difficult task. I followed this article and am doing everything correctly. There seems to be plenty of other similar questions, which also do not have any answers. Is this just an issue with GitLab CI that we have no control over?\nI'm also now thinking that it has something to do with the fact that the SSH server is another GitLab repo. Maybe GitLab CI blocks SSH connections within the same network. Not sure why but it's a possibility. Also don't know how you'd connect without SSH.\nEdit 5\nThe verbose output clearly was not working using GIT_SSH_COMMAND, so I tried an ssh connection without git:\nssh -vvvv [email protected]\n\nLog output:\nOpenSSH_6.7p1 Debian-5+deb8u5, OpenSSL 1.0.1t 3 May 2016\ndebug1: Reading configuration data /etc/ssh/ssh_config\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\nPseudo-terminal will not be allocated because stdin is not a terminal.\ndebug2: ssh_connect: needpriv 0\ndebug1: Connecting to gitlab.com [35.231.145.151] port 22.\ndebug1: Connection established.\ndebug1: permanently_set_uid: 0/0\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_rsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_rsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_dsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_dsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_ecdsa type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_ecdsa-cert type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_ed25519 type -1\ndebug1: key_load_public: No such file or directory\ndebug1: identity file /root/.ssh/id_ed25519-cert type -1\ndebug1: Enabling compatibility mode for protocol 2.0\ndebug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u5\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.8\ndebug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.8 pat OpenSSH* compat 0x04000000\ndebug2: fd 3 setting O_NONBLOCK\ndebug3: load_hostkeys: loading entries for host \"gitlab.com\" from file \"/root/.ssh/known_hosts\"\ndebug3: load_hostkeys: loaded 0 keys\ndebug1: SSH2_MSG_KEXINIT sent\ndebug1: SSH2_MSG_KEXINIT received\ndebug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa,ssh-dss\ndebug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],[email protected],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,[email protected],[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,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: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1\ndebug2: kex_parse_kexinit: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519\ndebug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]\ndebug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1\ndebug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1\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: setup [email protected]\ndebug1: kex: server->client aes128-ctr [email protected] none\ndebug2: mac_setup: setup [email protected]\ndebug1: kex: client->server aes128-ctr [email protected] none\ndebug1: sending SSH2_MSG_KEX_ECDH_INIT\ndebug1: expecting SSH2_MSG_KEX_ECDH_REPLY\ndebug1: Server host key: ECDSA f1:d0:fb:46:73:7a:70:92:5a:ab:5d:ef:43:e2:1c:35\ndebug3: load_hostkeys: loading entries for host \"gitlab.com\" from file \"/root/.ssh/known_hosts\"\ndebug3: load_hostkeys: loaded 0 keys\ndebug3: load_hostkeys: loading entries for host \"35.231.145.151\" from file \"/root/.ssh/known_hosts\"\ndebug3: load_hostkeys: loaded 0 keys\ndebug1: read_passphrase: can't open /dev/tty: No such device or address\nHost key verification failed.\n\nThe second-last line indicates that it's trying to communicate with the terminal using the /dev/tty file. Of course, this script is running in a non-interactive manor so it fails. Shouldn't it be using my key instead of requesting a passphrase from the terminal?"
},
{
"role": "assistant",
"content": "You may need to try setting the mode to 644 rather than 700. 644 is what is suggested in the Verifying the SSH host keys documentation, and is also what SSH uses for this file by default. Some parts of SSH are very particular about this - I'm not sure if known_hosts is particular. \nThe docs also mention you should set the value of SSH_KNOWN_HOSTS variable to the entire output of ssh-keyscan since there are multiple keys. \nEDIT:\nThe following .gitlab-ci.yml worked for me on GitLab.com. Note the use of ~/.ssh/ rather than /.ssh/. \nimage: ubuntu:latest\n\ntest_job:\n script:\n - apt-get update\n - apt-get install openssh-client git-core -y\n - eval $(ssh-agent -s)\n - echo \"$SSH_DEPLOY_PRIVATE_KEY\" | tr -d '\\r' | ssh-add - > /dev/null\n - mkdir -p ~/.ssh && touch ~/.ssh/known_hosts\n - echo \"$SSH_KNOWN_HOSTS\" >> ~/.ssh/known_hosts\n - git clone [email protected]:gitlab-org/gitlab-ce.git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --remerge-diff"
},
{
"role": "assistant",
"content": "Produce remerge-diff output for merge commits.\nShortcut for --diff-merges=remerge -p ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Switch between user identities in one Git on one computer [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nCan I specify multiple users for myself in .gitconfig?\n\n (25 answers)\n \n\nClosed 10 years ago.\n\n\n\nI have ONE repository on GitHub, let's call it Repo-1.\nI want to first access that repository as a default Git user.\nLet's call that user User-1.\nI created SSH keypair, everything fine, works nice.\n\nI made ANOTHER repository on GitHub, let's call it Repo-2.\nI didn't make any changes in local Git, on my laptop. No configurational changes, nothing.\nNow - I want to clone from Repo-1 as the User-2 (but from the same laptop).\nFirst of all: is this at all possible to do?\nCan local Git on one single laptop switch between \"user accounts\" and present itself as User-2? And then, from THAT identity, clone from Repo-1, make some change, and then push to Repo-1?\nIf possible, how do I do that?"
},
{
"role": "assistant",
"content": "You have your global .gitconfig where you already configured your SSH Keys/User Information. The global .gitconfig is overridden by a local gitconfig - the file \"config\" in your .git folder (if it does not exist you might have to create it).\nFor example you can copy the .gitconfig file into the .git folder (and rename it to \"config\") and just change the lines you want to change (probably github.user and github.token) or you create a new file with just the two lines in it.\nIf you prefer the command line \"git config\" you can avoid all the file moving stuff by omitting the \"--global\" option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Set default reviewers for merge request in GitLab\n\nHow I can set default reviewers in GitLab Premium?\nIn Settings → General I have only Merge request (MR) approvals, not reviewers."
},
{
"role": "assistant",
"content": "You can use \"Default description template for merge requests\" either via Settings->Merge Requests or via file in .gitlab/merge_request_templates to do it via a workaround. (Doc)\nIn the template you can use the chat code\n/assign_reviewer @user1 @user2 @user3\n\nto automatically assign user1, user2 and user3 as reviewers when creating a new MR."
}
] |