messages listlengths 3 3 |
|---|
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git --log-window-size=<n>"
},
{
"role": "assistant",
"content": "Fetch <n> log entries per request when scanning Subversion history.\nThe default is 100. For very large Subversion repositories, larger\nvalues may be needed for clone / fetch to complete in reasonable\ntime. But overly large values may lead to higher memory usage and\nrequest timeouts."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "\"git add\" returning \"fatal: outside repository\" error\nI'm just entering into the wonderful world of git. \nI have to submit a bunch of changes that I've made on my program, located in a directory called /var/www/myapp.\nI created a new directory /home/mylogin/gitclone. From this directory, I did a git clone against the public repo and I was able to get the latest copy created. \nI'm now trying to figure out how to take all the files in my working folder (/var/www/myapp) and \"check them in\" to the master repository. \nFrom /home/mylogin/gitclone, I tried git add /var/www/myapp but I'm getting an error that the folder I tried to add is outside the repository.\nCan you give me a few pointers on what I'm doing wrong? Also, I'd like to add everything, whether it's different from the master or not. \nThanks."
},
{
"role": "assistant",
"content": "First in the clone folder you can create a Branch (so the master stay untouched)\ngit branch [branch_name]\n\nAfter, just copy the files you want from your old folder to the clone folder.\nWhen you are done, just add / commit your change and Merge your branch into the \"master\" branch. It will look like to something like this:\ngit add .\ngit commit -m \"Comments\"\ngit checkout master\ngit merge [new_branch]\n\nTry this tutorial from GitHub."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects git push"
},
{
"role": "assistant",
"content": "Works like git push <remote> , where <remote> is the\ncurrent branch’s remote (or origin , if no remote is\nconfigured for the current branch)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I see the size of a GitHub repository before cloning it?\n\nIs there a way to see how big a Git repository is on GitHub before you decide to clone it?\nThis seems like a really obvious/basic statistic, but I can't find how to see it on GitHub at all."
},
{
"role": "assistant",
"content": "There's a way to access this information through the GitHub API.\n\nSyntax: GET /repos/:user/:repo\nExample: https://api.github.com/repos/git/git\n\nWhen retrieving information about a repository, a property named size is valued with the size of the whole repository (including all of its history), in kilobytes.\nFor instance, the Git repository weights around 124 MB. The size property of the returned JSON payload is valued to 124283.\nUpdate\nThe size is indeed expressed in kilobytes based on the disk usage of the server-side bare repository. However, in order to avoid wasting too much space with repositories with a large network, GitHub relies on Git Alternates. In this configuration, calculating the disk usage against the bare repository doesn't account for the shared object store and thus returns an \"incomplete\" value through the API call.\nThis information has been given by GitHub support."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "fatal: The current branch master has no upstream branch\nI'm trying to push one of my projects to github, and I keep getting this error:\npeeplesoft@jane3:~/846156 (master) $ git push\n\nfatal: The current branch master has no upstream branch.\nTo push the current branch and set the remote as upstream, use\n\n git push --set-upstream origin master\n\nSo I tried it and got this:\npeeplesoft@jane3:~/846156 (master) $ git push --set-upstream origin master\n\nfatal: Authentication failed\n\nAnother stackoverflow thread suggested I try the following, with disappointing results.\npeeplesoft@jane3:~/846156 (master) $ git push -u origin master\n\nfatal: Authentication failed\n\nThen I tried this:\npeeplesoft@jane3:~/846156 (master) $ git config remote.origin.push HEAD\n\npeeplesoft@jane3:~/846156 (master) $ git push\n\nfatal: Authentication failed\n\nAny hints?"
},
{
"role": "assistant",
"content": "You fixed the push, but, independently of that push issue (which I explained in \"Why do I need to explicitly push a new branch?\": git push -u origin master or git push -u origin --all), you need now to resolve the authentication issue.\nThat depends on your url (ssh as in '[email protected]/yourRepo, or https as in https://github.com/You/YourRepo)\nFor https url:\nIf your account is protected by the two-factor authentication, your regular password won't work (for https url), as explained here or here.\nSame problem if your password contains special character (as in this answer)\nIf https doesn't work (because you don't want to generate a secondary key, a PAT: personal Access Token), then you can switch to ssh, as I have shown here.\n\nAs noted by qwerty in the comments, you can automatically create the branch of same name on the remote with:\ngit push -u origin head \n\nWhy?\n\nHEAD (see your .git\\HEAD file) has the refspec of the currently checked out branch (for example: ref: refs/heads/master)\nthe default push policy is simple\n\nSince the refpec used for this push is head: (no destination), a missing :<dst> means to update the same ref as the <src> (head, which is a branch).\nThat won't work if HEAD is detached though.\n\nOr you can use Git 2.37 (Q3 2022) and the new global option push.autoSetupRemote:\ngit config --global push.autoSetupRemote true\ngit push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitosis alternative?\nAre there alternatives to gitosis that are easier to use? \nI currently run gitosis on a Ubuntu server for my lab. We regularly add new users and repos. I find the gitosis.conf syntax non-intuitive, and if I make even a minor mistake the whole gitosis system fails, see for example this question on SO. When gitosis fails it also kills access to the git repository that contains gitosis.conf... go figure... There must be a better way.\nI've thought about private GitHub accounts, but is there anything else that I could host locally?"
},
{
"role": "assistant",
"content": "Gitolite might be a solution."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-checkout-index - Copy files from the index to the working tree --"
},
{
"role": "assistant",
"content": "Do not interpret any more arguments as options."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Should Git Repo's be at the Solution Level or Project Level in Visual Studio\nIf I have a C# solution with multiple projects in it, what would be better, to have the Git repo created in the solution folder, or in each individual project folder? Multiple developers will be working on the projects. What are your experiences with this?"
},
{
"role": "assistant",
"content": "I use several (sometimes overlapping) solutions to contain a collection of related independent applications and shared libraries. As others have mentioned, you really don't want to have a single Git repository containing the source for multiple, independent projects as it makes it much too difficult to track isolated changes.\nSo, if your solution is structured as mine is then you will definitely want individual Git repositories for each project. This has worked well for me for ten to twelve applications and doesn't create as much maintenance overhead as you might think.\nIf your solution is truly monolithic (and you're sure you want it that way forever and ever), then it probably makes sense to only have a single repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Generating a gitlab ssh key from windows\n\nI've tried following this guide on generating an ssh key in order to use gitlab.\nBefore I know if I should generate a key I must check if there is one already like this:\ntype %userprofile%\\.ssh\\id_rsa.pub\n\nIf it says this, then I must generate the key:\nthe system cannot find the path specified\n\nWhat is the next step? Because the guide doesn't say anything in case this is the message I get.\nEdit: I've tried\nssh-keygen -t rsa -C \"[email protected]\"\n\nAnd I get \n'ssh-keygen' is not recognized as an internal or external command, \noperable program or batch file.\n\nEdit 2: I am on windows."
},
{
"role": "assistant",
"content": "ON windows if you have git for windows installed, run git-gui. Then click Help then click Show Ssh Key, then click Generate Key.\nWhile you're at it, then copy to the clipboard, and then go to your Gitlab account page and add the SSH key to your Gitlab account's ssh settings."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-daemon - A really simple server for Git repositories --listen=<host-or-ipaddr>"
},
{
"role": "assistant",
"content": "Listen on a specific IP address or hostname. IP addresses can\nbe either an IPv4 address or an IPv6 address if supported. If IPv6\nis not supported, then --listen=<hostname> is also not supported and\n--listen must be given an IPv4 address.\nCan be given more than once.\nIncompatible with --inetd option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to setup two PyPI indices\n\nI have a local GitLab installation that comes with a local PyPI server to store company internal Python packages.\nHow can I configure my PyPI to search packages in both index servers?\nI read about .pypirc / pip/pip.ini and found various settings but no solution so far.\n\nMost solutions permanently switch all searches to the other index server. But I want to be able to install and update packages from pypi.org as normal while some packages come from the local index.\nsetting multiple index servers with credentials seams to be limited to distutils (used e.g. by twine) only, but is not used by pip\nThere is confusion if to configure index servers in [global] or [install]. I assume the latter one is a rule subset for pip install. (The documentation is here unclear.)\nWhile twine can reference a repository entry in the config file like -r gitlab refers to a [gitlab] section, such a named reference can't be used by pip...\n\nSo what I want to achieve:\n\npip should be able to install and update regular packages from pypi.org like colorama\npip should be able to install and update packages from gitlab.company.com\n\nauthentication with username (__token__) and password (7a3b62342c784d87) must work\n\n\n\nExperiment so far:\n[global]\n\n\n[install]\nfind-links =\n https://pypi.org\n https://gitlab.company.de/api/v4/projects/2142423/packages/pypi\ntrusted-host =\n https://pypi.org\n https://gitlab.company.de/api/v4/projects/2142423/packages/pypi\n\n[distutils]\nindex-servers =\n gitlab\n\n[gitlab]\nrepository = https://gitlab.company.de/api/v4/projects/2142423/packages/pypi\nusername = __token__\npassword = geheim"
},
{
"role": "assistant",
"content": "Goal\n\npip install should install/update packages from GitLab as well as PyPi repo. If same package is present in both, PyPi is preferred.\npip install should support authentication. Preferred, if somehow we can make it read from a config file so that we don't need to specify it repeatatively.\n\nTheory\n\npip install supports --extra-index-url to specify additional PyPi indexes. The same can also be provided via pip.conf file.\npip uses requests which supports ~/.netrc as config file (docs).\n\nSteps\n\nCreate a pip.conf (pip.ini if on Windows) in any of the locations suggested by pip config -v list.\nAdd your GitLab PyPi index URL to pip.conf.\n\n[install]\nextra-index-url = https://gitlab.com/api/v4/projects/12345678/packages/pypi/simple\n\n\nCreate or update your ~/.netrc file and add your auth details for GitLab.\n\nmachine gitlab.com\n login <token-name>\n password <token-pass>\n\n\nWe can now install packages as simply as pip install <package-name>. pip will now look at both indexes to find your packages, with preference provided to the one pointed by index-url.\n\nAdditional info\n\nThe same could have been possible for pip search too, had there been support for multiple indexes. Till then, one needs to manually specify which PyPi index URL should be used. GitLab does not seem to support pip search since it throws 415 Client Error: Unsupported Media Type when specified as the PyPi index.\nAs for your doubts, each section in pip.conf points to that particular command, [install] provides configuration for pip install, [search] for pip search and so on. [global] probably refers to parameters that can be specified for all the commands be it pip install or pip search.\n.pypirc file is made specially for configuring package indexes related to upload (used by twine/flint), where as pip.conf is associated with configuring pip which manages python packages on your local system."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to extract one file with commit history from a Git repo with index-filter & co?\nI have a Git repo converted from SVN to Mercurial to Git, and I wanted to extract just one source file. I also had weird characters like aÌ (an encoding mismatch corrupted Unicode ä) and spaces in the filenames.\nHow can I extract one file from a repository and place it at the root of the new repo?"
},
{
"role": "assistant",
"content": "A faster and easier-to-understand filter that accomplishes the same thing:\ngit filter-branch --index-filter '\n git read-tree --empty\n git reset $GIT_COMMIT -- $your $files $here\n ' \\\n -- --all -- $your $files $here"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_FLUSH"
},
{
"role": "assistant",
"content": "If this Boolean environment variable is set to true, then commands such\nas git blame (in incremental mode), git rev-list , git log , git check-attr and git check-ignore will\nforce a flush of the output stream after each record have been\nflushed. If this\nvariable is set to false, the output of these commands will be done\nusing completely buffered I/O. If this environment variable is\nnot set, Git will choose buffered or record-oriented flushing\nbased on whether stdout appears to be redirected to a file or not."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "dynamically setting artifact path/folder structure on gitlab-ci.yml\n\nI have the following gitlab-ci.yml file that reads the package.json using the jq processor to dynamically set the variable name of the artifact folder, something along the lines of \nimage: node:latest\n\nstages:\n - build\n\nbefore_script:\n ## steps ignored for purpose of question\n - export NAME_OF_ARTIFACT_FOLDER=$(cat package.json | jq -r .name)\"_\"$(cat package.json | jq -r .version)\".zip\"\n - echo $NAME_OF_ARTIFACT_FOLDER ##prints the expected name here eg. myApp_1.0.0.zip\n\nprod_build:\n stage: build\n script:\n - echo $NAME_OF_ARTIFACT_FOLDER ##prints the expected name here eg. myApp_1.0.0.zip\n - yarn run build\n artifacts:\n paths:\n - dist/$NAME_OF_ARTIFACT_FOLDER ## this does not work\n expire_in: 2 hrs\n\nThe issue here is - dist/$NAME_OF_ARTIFACT_FOLDER does not work, not sure if am missing something here.\nEDIT\nUpon hard coding the expected path such as the following, it works fine, which would mean that the folder name is valid and that the artifact is indeed identified appropriately, but does NOT work when coming from $NAME_OF_ARTIFACT_FOLDER\n artifacts:\n paths:\n - dist/myApp_1.0.0.zip ##hardcoding the expected works just fine\n expire_in: 2 hrs"
},
{
"role": "assistant",
"content": "While @Jakub Kania was not that wrong with it's summary\n\nhttps://stackoverflow.com/a/49659852/529977\nThat is no variables set in your script part of the job can be used.\n\nand I have to redict my own comment beneath @Matt Bracewell's post\n\nhttps://stackoverflow.com/a/66707954/529977\nI don't see this will help anything because it addresses artifacts:name but not artifacts:paths . paths is still not dynamically usable as you can see in https://docs.gitlab.com/ee/ci/variables/where_variables_can_be_used.html\n\n~~the undocumented part says:__~~\nyou can use any variable in artifacts:path that is available at job level\ni.e.\n prod_build:\n+ variables:\n+ NAME_OF_ARTIFACT: \"myApp_*.zip\"\n stage: build\n script:\n - echo $NAME_OF_ARTIFACT\n - yarn run build\n artifacts:\n paths:\n - dist/$NAME_OF_ARTIFACT\n expire_in: 2 hrs\n\nThat's indeed consequent to what is asked in Artifacts Filename Cannot Be Set with Dynamic Variables even they don't ask for paths but names\ngenerate for myself:\n script:\n - mkdir build\n - |\n cat > build/artifact1$$.txt <<EOF\n Hello World! ${CI_PROJECT_ID} ${CI_PIPELINE_IID}\n EOF\n - export MY_VAR_FILE_NAME=artifact1$$\n - echo \"MY_VAR_FILE_NAME=${MY_VAR_FILE_NAME}\" >> generate.env\n - |\n cat > build/artifact2$$.txt <<EOF\n The end is near! ${CI_PROJECT_ID} ${CI_PIPELINE_IID}\n EOF\n - export MY_VAR_FILE2_NAME=artifact2$$\n - echo \"MY_VAR_FILE2_NAME=${MY_VAR_FILE2_NAME}\" >> generate.env\n - |\n cat > build/ci${CI_PIPELINE_IID}.txt <<EOF\n Happy to hear you! ${CI_PROJECT_ID} ${CI_PIPELINE_IID}\n EOF\n artifacts:\n reports:\n # using the https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsdotenv \n # does NOT do the trick to fill a job variable before artifact:paths is evaluated!\n dotenv: generate.env\n paths: \n - build/ci${CI_PIPELINE_IID}.txt # WORKS!\n - build/$MY_VAR_FILE_NAME.txt # doen't work\n - build/$MY_VAR_FILE2_NAME.txt # doen't work\n\n⚠️ unknown variables are expanded to empty and build/$MY_VAR_FILE_NAME.txt becomes build/ i.e. all files in build folder are artifacts - mentioned in pipeline out WARNING: build/.txt: no matching files. Ensure that the artifact path is relative to the working directory resp. unexpected build/: found 4 matching files and directories\nAs a workaround - but yes, it's ugly -, you can do the trick either by using wildcards (but I assume you have good reasons to do not)\nprod_build\n artifacts:\n paths:\n - dist/*.zip\n\nOR splitting into two jobs\ngenerate before save:\n script:\n - mkdir build\n - |\n cat > build/artifact1$$.txt <<EOF\n Hello World! ${CI_PROJECT_ID} ${CI_PIPELINE_IID}\n EOF\n - export MY_VAR_FILE_NAME=artifact1$$\n - echo \"MY_VAR_FILE_NAME=${MY_VAR_FILE_NAME}\" >> generate.env\n - |\n cat > build/artifact2$$.txt <<EOF\n The end is near! ${CI_PROJECT_ID} ${CI_PIPELINE_IID}\n EOF\n - export MY_VAR_FILE2_NAME=artifact2$$\n - echo \"MY_VAR_FILE2_NAME=${MY_VAR_FILE2_NAME}\" >> generate.env\n artifacts:\n reports:\n # using the https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsdotenv trick to fill a job variable for downstream of successor job\n dotenv: generate.env\n paths: \n - build/*.txt\n\nsave artifacts:\n ## this is your expected input:\n # variables:\n # MY_VAR_FILE_NAME: #filled by dotenv\n # MY_VAR_FILE2_NAME: #filled by dotenv\n needs:\n - generate before save\n script:\n - find build/\n - echo \"expecting … \"\n - echo \"- $MY_VAR_FILE_NAME\"\n - echo \"- $MY_VAR_FILE2_NAME\"\n artifacts:\n paths: \n - build/$MY_VAR_FILE_NAME.txt # WORKS\n - build/$MY_VAR_FILE2_NAME.txt # WORKS\n\ni.e. in your case:\nimage: node:latest\n\nstages:\n - build\n\npre_prod_build:\n stage: build\n script:\n ## steps ignored for purpose of question\n - export NAME_OF_ARTIFACT_FOLDER=$(cat package.json | jq -r .name)\"_\"$(cat package.json | jq -r .version)\".zip\"\n - echo $NAME_OF_ARTIFACT_FOLDER ##prints the expected name here eg. myApp_1.0.0.zip\n - echo \"NAME_OF_ARTIFACT_FOLDER=${NAME_OF_ARTIFACT_FOLDER}\" >> artifact_name.dotenv\n artifacts:\n reports:\n dotenv: artifact_name.dotenv\n\nprod_build:\n stage: build\n ## this is your expected input:\n # variables:\n # NAME_OF_ARTIFACT_FOLDER: # set by pre_prod_build dotenv\n needs:\n - job: pre_prod_build\n script:\n - echo $NAME_OF_ARTIFACT_FOLDER ##prints the expected name here eg. myApp_1.0.0.zip\n - yarn run build\n artifacts:\n paths:\n - dist/$NAME_OF_ARTIFACT_FOLDER ## NOW IT WORKS\n expire_in: 2 hrs"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-fetch-pack"
},
{
"role": "assistant",
"content": "Receive missing objects from another repository"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Github file change notification\nIs there a way to notify people on change of some certain files? Specifically, I would like to track change of *.sql files and and notify our developers on a change. How can I configure post commit hooks to notify?"
},
{
"role": "assistant",
"content": "If you want folks to get notified via email, and you want them to manage their own notifications, then https://app.github-file-watcher.com/ should do the trick - it monitors any public repo, and will notify you via email of changes to any file, a specific file, or some files that match your criteria."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects --color-moved[=<mode>]"
},
{
"role": "assistant",
"content": "Moved lines of code are colored differently.\nThe <mode> defaults to no if the option is not given\nand to zebra if the option with no mode is given.\nThe mode must be one of: no Moved lines are not highlighted. default Is a synonym for zebra . This may change to a more sensible mode\nin the future. plain Any line that is added in one location and was removed\nin another location will be colored with color.diff.newMoved .\nSimilarly color.diff.oldMoved will be used for removed lines\nthat are added somewhere else in the diff. This mode picks up any\nmoved line, but it is not very useful in a review to determine\nif a block of code was moved without permutation. blocks Blocks of moved text of at least 20 alphanumeric characters\nare detected greedily. The detected blocks are\npainted using either the color.diff.{old,new}Moved color.\nAdjacent blocks cannot be told apart. zebra Blocks of moved text are detected as in blocks mode. The blocks\nare painted using either the color.diff.{old,new}Moved color or color.diff.{old,new}MovedAlternative . The change between\nthe two colors indicates that a new block was detected. dimmed-zebra 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": "How to make git ignore changes in case?\nI'm not too sure what is going on here, but sometimes a particular file in my repository will change the case of its name. e.g.,:\nbefore: File.h\nafter: file.h\nI don't really care why this is happening, but this causes git to think it is a new file, and then I have to go and change the file name back. Can you just make git ignore case changes?\n[edit]\nI suspect it is Visual Studio doing something weird with that particular file, because it seems to happen most often when I open and save it after changes. I don't have any way to fix bugs in VS however, but git should be a bit more capable I hope."
},
{
"role": "assistant",
"content": "Since version 1.5.6 there is an ignorecase option available in the [core] section of .git/config\ne.g. add ignorecase = true\nTo change it for just one repo, from that folder run:\ngit config core.ignorecase true\n\nTo change it globally: \ngit config --global core.ignorecase true"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-grep - Print lines matching a pattern -m <num> --max-count <num>"
},
{
"role": "assistant",
"content": "Limit the amount of matches per file. When using the -v or --invert-match option, the search stops after the specified\nnumber of non-matches. A value of -1 will return unlimited\nresults (the default). A value of 0 will exit immediately with\na non-zero status."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitHub Actions - empty env secrets\n\nI've started playing with GitHub actions, but I'm struggling with accessing repository secrets which I pass as env's.\nMy workflow file:\nname: Invite\n\non: \n pull_request:\n branches: [master]\n types: [closed]\njobs:\n invite:\n runs-on: ubuntu-latest\n steps:\n - name: Hello world action\n uses: lekterable/inclusive-organization-action@master\n env:\n SECRET_TOKEN: ${{ secrets.SECRET_TOKEN }}\n organization: string\n SUPER_SECRET: ${{ secrets.SUPER_SECRET }}\n\naction index file\nconst core = require('@actions/core')\nconst github = require('@actions/github')\n\nconst run = async () => {\n try {\n ...\n console.log('env', process.env)\n const token = process.env.SECRET_TOKEN\n const secret = process.env.SUPER_SECRET\n const organization = process.env.organization\n console.log('organization', organization)\n console.log('token?', !!token)\n console.log('secret?', !!secret)\n console.log('token length', token.length)\n ...\n } catch (error) {\n core.setFailed(error.message)\n }\n}\n\nrun()\n\n\nas you can see I'm passing 3 env's, the organization which has a value of 'string' exists as expected, but SECRET_TOKEN and SUPER_SECRET are empty.\n\nAnd yes, I do have the secrets set in the repo which runs the action:\n\nIs there something that I'm doing wrong?"
},
{
"role": "assistant",
"content": "In my case I had to pass the secrets to a reusable workflow by adding secrets: inherit to the parent job\njobs:\n call-workflow-passing-data:\n uses: octo-org/example-repo/.github/workflows/reusable-workflow.yml@main\n with:\n config-path: .github/labeler.yml\n secrets: inherit # <= this one\n\nDoc: https://docs.github.com/en/actions/using-workflows/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Undo a git commit\nCan you undo a past commit, that has long been merged into your git repository, via a git command? Or do you have to manually undo all the changes made in that commit?"
},
{
"role": "assistant",
"content": "You can always just revert the changes from a single commit by doing:\ngit revert <commit-id>\n\nnote that this creates a new commit, undoing just those changes\nE.g. git log --oneline\nd806fc9 two\n18cdfa2 bye\n62c332e hello\nc7811ee initial\n\nSay I want to revert changes in commit 18cdfa2:\ngit revert 18cdfa2\n\nWe now have: git log -1 -p\ncommit fb9d6627a71636503fc9a1eb4f725937c783ecee\nAuthor: Seth <sehe@mint12.(none)>\nDate: Wed Oct 3 10:32:46 2012 +0200\n\n Revert \"bye\"\n\n This reverts commit 18cdfa27c964b66b624be1030250757b745d6866.\n\ndiff --git a/a b/a\nindex 0907563..3b18e51 100644\n--- a/a\n+++ b/a\n@@ -1 +1 @@\n-bye world\n+hello world"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "key_load_public: invalid format\nI used PuTTY Key Generator to generate a 4096 bit RSA-2 key with a passphrase.\nI save the .ppk and an openSSL format public key. The putty format public key doesn't work.\nIn any case, my error is as follows:\n$ ssh -T [email protected]\nkey_load_public: invalid format\nEnter passphrase for key '/c/Users/Dan/.ssh/id_rsa':\nHi Dan! You've successfully authenticated, but GitHub does not provide shell access.\n\nWhat's the issue?\nI use Pageant to load the keys and i use Git Bash to try the ssh connection. I've also loaded the key into GitHub, not sure what i'm doing wrong.\nI've tried adding a new line and not adding a new line in GitHub"
},
{
"role": "assistant",
"content": "As Roland mentioned in their answer, it's a warning that the ssh-agent doesn't understand the format of the public key and even then, the public key will not be used locally.\nHowever, I can also elaborate and answer why the warning is there. It simply boils down to the fact that the PuTTY Key Generator generates two different public key formats depending on what you do in the program.\nNote: Throughout my explanation, the key files I will be using/generating will be named id_rsa with their appropriate extensions. Furthermore, for copy-paste convenience, the parent folder of the keys will be assumed to be ~/.ssh/. Adjust these details to suit your needs as desired.\nThe Formats\nLink to the relevant PuTTY documentation\nSSH-2\nWhen you save a key using the PuTTY Key Generator using the \"Save public key\" button, it will be saved in the format defined by RFC 4716.\nExample:\n---- BEGIN SSH2 PUBLIC KEY ----\nComment: \"github-example-key\"\nAAAAB3NzaC1yc2EAAAABJQAAAQEAhl/CNy9wI1GVdiHAJQV0CkHnMEqW7+Si9WYF\ni2fSBrsGcmqeb5EwgnhmTcPgtM5ptGBjUZR84nxjZ8SPmnLDiDyHDPIsmwLBHxcp\npY0fhRSGtWL5fT8DGm9EfXaO1QN8c31VU/IkD8niWA6NmHNE1qEqpph3DznVzIm3\noMrongEjGw7sDP48ZTZp2saYVAKEEuGC1YYcQ1g20yESzo7aP70ZeHmQqI9nTyEA\nip3mL20+qHNsHfW8hJAchaUN8CwNQABJaOozYijiIUgdbtSTMRDYPi7fjhgB3bA9\ntBjh7cOyuU/c4M4D6o2mAVYdLAWMBkSoLG8Oel6TCcfpO/nElw==\n---- END SSH2 PUBLIC KEY ----\n\nOpenSSH\nContrary to popular belief, this format doesn't get saved by the generator. However it is generated and shown in the text box titled \"Public key for pasting into OpenSSH authorized_keys file\". To save it as a file, you have to manually copy it from the text box and paste it into a new text file.\nFor the key shown above, this would be:\nssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAhl/CNy9wI1GVdiHAJQV0CkHnMEqW7+Si9WYFi2fSBrsGcmqeb5EwgnhmTcPgtM5ptGBjUZR84nxjZ8SPmnLDiDyHDPIsmwLBHxcppY0fhRSGtWL5fT8DGm9EfXaO1QN8c31VU/IkD8niWA6NmHNE1qEqpph3DznVzIm3oMrongEjGw7sDP48ZTZp2saYVAKEEuGC1YYcQ1g20yESzo7aP70ZeHmQqI9nTyEAip3mL20+qHNsHfW8hJAchaUN8CwNQABJaOozYijiIUgdbtSTMRDYPi7fjhgB3bA9tBjh7cOyuU/c4M4D6o2mAVYdLAWMBkSoLG8Oel6TCcfpO/nElw== github-example-key\n\nThe format of the key is simply ssh-rsa <signature> <comment> and can be created by rearranging the SSH-2 formatted file.\nRegenerating Public Keys\nIf you are making use of ssh-agent, you will likely also have access to ssh-keygen.\nIf you have your OpenSSH Private Key (id_rsa file), you can generate the OpenSSH Public Key File using:\nssh-keygen -f ~/.ssh/id_rsa -y > ~/.ssh/id_rsa.pub\n\nIf you only have the PUTTY Private Key (id_rsa.ppk file), you will need to convert it first.\n\nOpen the PuTTY Key Generator\nOn the menu bar, click \"File\" > \"Load private key\"\nSelect your id_rsa.ppk file\nOn the menu bar, click \"Conversions\" > \"Export OpenSSH key\"\nSave the file as id_rsa (without an extension)\n\nNow that you have an OpenSSH Private Key, you can use the ssh-keygen tool as above to perform manipulations on the key.\nBonus: The PKCS#1 PEM-encoded Public Key Format\nTo be honest, I don't know what this key is used for as I haven't needed it. But I have it in my notes I've collated over the years and I'll include it here for wholesome goodness. The file will look like this:\n-----BEGIN RSA PUBLIC KEY-----\nMIIBCAKCAQEAhl/CNy9wI1GVdiHAJQV0CkHnMEqW7+Si9WYFi2fSBrsGcmqeb5Ew\ngnhmTcPgtM5ptGBjUZR84nxjZ8SPmnLDiDyHDPIsmwLBHxcppY0fhRSGtWL5fT8D\nGm9EfXaO1QN8c31VU/IkD8niWA6NmHNE1qEqpph3DznVzIm3oMrongEjGw7sDP48\nZTZp2saYVAKEEuGC1YYcQ1g20yESzo7aP70ZeHmQqI9nTyEAip3mL20+qHNsHfW8\nhJAchaUN8CwNQABJaOozYijiIUgdbtSTMRDYPi7fjhgB3bA9tBjh7cOyuU/c4M4D\n6o2mAVYdLAWMBkSoLG8Oel6TCcfpO/nElwIBJQ==\n-----END RSA PUBLIC KEY-----\n\nThis file can be generated using an OpenSSH Private Key (as generated in \"Regenerating Public Keys\" above) using:\nssh-keygen -f ~/.ssh/id_rsa -y -e -m pem > ~/.ssh/id_rsa.pem\n\nAlternatively, you can use an OpenSSH Public Key using:\nssh-keygen -f ~/.ssh/id_rsa.pub -e -m pem > ~/.ssh/id_rsa.pem\n\n##References:##\n\n\"key_load_public: invalid format...\" on AskUbuntu\nThe Secure Shell (SSH) Public Key File Format\nConverting OpenSSH public keys"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to remove files from git staging area?\nI made changes to some of my files in my local repo, and then I did git add -A which I think added too many files to the staging area. How can I delete all the files from the staging area?\nAfter I do that, I'll just manually do git add \"filename\"."
},
{
"role": "assistant",
"content": "You can unstage files from the index using\ngit reset HEAD -- path/to/file\n\nJust like git add, you can unstage files recursively by directory and so forth, so to unstage everything at once, run this from the root directory of your repository:\ngit reset HEAD -- .\n\nAlso, for future reference, the output of git status will tell you the commands you need to run to move files from one state to another."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --patch-with-raw"
},
{
"role": "assistant",
"content": "Synonym for -p --raw ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-show - Show various types of objects patience"
},
{
"role": "assistant",
"content": "Use \"patience diff\" algorithm when generating patches."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "gitglossary - A Git Glossary pack index"
},
{
"role": "assistant",
"content": "The list of identifiers, and other information, of the objects in a pack , to assist in efficiently accessing the contents of a\npack."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git authentication fails after enabling 2FA\n\nI just enabled 2FA (I can't think of any other changes I made) and git asked for my username and password. I provided both, but they were \"wrong\". I tried many of the solutions here: Git push requires username and password but that didn't work. In particular, when switching from https to ssh, the ssh key gives \nPermission denied (publickey).\nfatal: Could not read from remote repository.\n$ git push\nwarning: push.default is unset; its implicit value is changing in\nGit 2.0 from 'matching' to 'simple'. To squelch this message\nand maintain the current behavior after the default changes, use:\n\n git config --global push.default matching\n\nTo squelch this message and adopt the new behavior now, use:\n\n git config --global push.default simple\n\nSee 'git help config' and search for 'push.default' for further information.\n(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n'current' instead of 'simple' if you sometimes use older versions of Git)\n\nUsername for 'https://github.com': **********\nPassword for 'https://[email protected]': \nremote: Invalid username or password.\nfatal: Authentication failed for 'https://github.com/mlbileschi/scala.git/'\n\nAny tips?"
},
{
"role": "assistant",
"content": "You need to generate an access token. You can create one by going to your settings page.\n\nUse this access token as your password in the command line."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-branch - List, create, or delete branches --sort=<key>"
},
{
"role": "assistant",
"content": "Sort based on the key given. Prefix - to sort in descending\norder of the value. You may use the --sort=<key> option\nmultiple times, in which case the last key becomes the primary\nkey. The keys supported are the same as those in git\nfor-each-ref . Sort order defaults to the value configured for the branch.sort variable if it exists, or to sorting based on the\nfull refname (including refs/... prefix). This lists\ndetached HEAD (if present) first, then local branches and\nfinally remote-tracking branches. See git-config ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I pipe in FileMerge as a diff tool with git on OS X?\nI'm new to git on OS X, and I'm using it via the command line. I come from the world of Tortoise SVN and Beyond Compare on Windows.\nI want to be able to send diffs to FileMerge.\nI was able to do this with TextMate simply by using:\ngit diff | mate\n\nBut I'm not sure how to get that set up so I can use FileMerge instead?"
},
{
"role": "assistant",
"content": "Although it's not exactly the same as piping stdin into a script, you can do this:\ngit difftool -t opendiff -y\n\nThat will launch FileMerge once for each file. Doing the whole project tree at once takes a little scripting.\nSee also this question."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Jenkins Git plugin detached HEAD\nI am new to Git and also to Jenkins. My problem is that I can't get the Jenkins Maven release plugin to work.\nWhen I build a common Maven build with Jenkins, it works well, but when I try to perform a release with the Maven release plugin, I get the following stack trace:\norg.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project parent: An error is occurred in the checkin process: Exception while executing SCM command.\n at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)\n at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)\n at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)\n at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)\n at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)\n at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)\n at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)\n at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)\n at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)\n at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)\n at java.lang.reflect.Method.invoke(Method.java:597)\n at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)\n at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)\n at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)\n at hudson.maven.Maven3Builder.call(Maven3Builder.java:98)\n at hudson.maven.Maven3Builder.call(Maven3Builder.java:64)\n at hudson.remoting.UserRequest.perform(UserRequest.java:118)\n at hudson.remoting.UserRequest.perform(UserRequest.java:48)\n at hudson.remoting.Request$2.run(Request.java:326)\n at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)\n at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)\n at java.util.concurrent.FutureTask.run(FutureTask.java:138)\n at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)\n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)\n at java.lang.Thread.run(Thread.java:662)\nCaused by: org.apache.maven.plugin.MojoExecutionException: An error is occurred in the checkin process: Exception while executing SCM command.\n at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:295)\n at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:247)\n at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)\n at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)\n ... 27 more\nCaused by: org.apache.maven.shared.release.ReleaseExecutionException: An error is occurred in the checkin process: Exception while executing SCM command.\n at org.apache.maven.shared.release.phase.AbstractScmCommitPhase.checkin(AbstractScmCommitPhase.java:160)\n at org.apache.maven.shared.release.phase.AbstractScmCommitPhase.performCheckins(AbstractScmCommitPhase.java:145)\n at org.apache.maven.shared.release.phase.ScmCommitPreparationPhase.runLogic(ScmCommitPreparationPhase.java:76)\n at org.apache.maven.shared.release.phase.AbstractScmCommitPhase.execute(AbstractScmCommitPhase.java:78)\n at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)\n at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)\n at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)\n at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)\n at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:291)\n ... 30 more\nCaused by: org.apache.maven.scm.ScmException: Exception while executing SCM command.\n at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:63)\n at org.apache.maven.scm.provider.git.AbstractGitScmProvider.executeCommand(AbstractGitScmProvider.java:291)\n at org.apache.maven.scm.provider.git.AbstractGitScmProvider.checkin(AbstractGitScmProvider.java:217)\n at org.apache.maven.scm.provider.AbstractScmProvider.checkIn(AbstractScmProvider.java:410)\n at org.apache.maven.shared.release.phase.AbstractScmCommitPhase.checkin(AbstractScmCommitPhase.java:156)\n ... 38 more\nCaused by: org.apache.maven.scm.ScmException: Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref\n at org.apache.maven.scm.provider.git.gitexe.command.branch.GitBranchCommand.getCurrentBranch(GitBranchCommand.java:147)\n at org.apache.maven.scm.provider.git.gitexe.command.checkin.GitCheckInCommand.createPushCommandLine(GitCheckInCommand.java:192)\n at org.apache.maven.scm.provider.git.gitexe.command.checkin.GitCheckInCommand.executeCheckInCommand(GitCheckInCommand.java:132)\n at org.apache.maven.scm.command.checkin.AbstractCheckInCommand.executeCommand(AbstractCheckInCommand.java:54)\n at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)\n ... 42 more\nchannel stopped\nFinished: FAILURE\n\nThe failing command and error message are:\n[INFO] Executing: /bin/sh -c cd\n/var/lib/jenkins/workspace/test_maven/parent && git symbolic-ref HEAD\n[INFO] Working directory:\n/var/lib/jenkins/workspace/test_maven/parent mojoFailed\norg.apache.maven.plugins:maven-release-plugin:2.3.2(default-cli)\nprojectFailed ch.apkern.achilles:parent:1.0-SNAPSHOT sessionEnded\n\nI have figured out that the Jenkins Git plugin creates a detached HEAD ref \"(no branch)\" which causes the problem, I think. But I have absolutely no idea why this ref is created or how I can solve this problem.\nI would be grateful for any help."
},
{
"role": "assistant",
"content": "The Checkout/merge to local branch (optional) field is gone in the current (2.2.1) version of the Git plugin.\nIt has moved to Additional Behaviours → Check out to specific local branch:\n\nSetting that value to master got me a checked out branch instead of a detached head."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "how to undo all whitespace changes with git\nI have a git repo, where I replaced a lot of files locally.\ngit status now shows many many modified files.\nSome are \"really modified\", others only differ by line endings.\nI want the ones that differ only by line endings to go away (git reset them), but\nI cannot seem to find the linux-piping-foo to make it happen.\nBonus points for how to remove files whose only difference is the executable bit."
},
{
"role": "assistant",
"content": "This will do it:\n git diff -b --numstat \\\n| egrep $'^0\\t0\\t' \\\n| cut -d$'\\t' -f3- \\\n| xargs git checkout HEAD --\n\n\nRun a diff of the working copy against the index and give a machine-readable summary for each file, ignoring changes in whitespace.\nFind the files that had no changes according to diff -b.\nTake their names.\nPass them to git checkout against the branch tip.\n\nThis pipe will do something sensible for each step you leave off, so you can start off with the just the first line and add more to see what happens at each step.\nA possibly useful alternative last line:\n| git checkout-index --stdin\n\nThis would reset the files to their staged contents instead of to their last committed state.\nYou may also want to use git diff HEAD on the first line instead, to get a diff of the working copy against the last commit instead of against the index.\n\nNote: if you have filenames with spaces in them, you will first need to add a tr:\n git diff -b --numstat \\\n| egrep $'^0\\t0\\t' \\\n| cut -d$'\\t' -f3- \\\n| tr '\\n' '\\0' \\\nThen you must add a -0/-z switch to whichever final command you wanted to use:\n| xargs -0 git checkout HEAD --\n# or\n| git checkout-index --stdin -z"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I remove my last commit in my local git repository\nWhen I do a 'git pull', I have conflict with the head commit. So I did a 'git rebase --abort'\nCan I 'save' my commit to a \"patch\" and then do a git pull?\nWhat I want to emulate is:\n\nI did not commit, but I did a 'git stash' instead\nDo a git pull to avoid any merge error\n\nSo I need somehow to 'turn back the clock'. Is that possible with git?"
},
{
"role": "assistant",
"content": "Your 7826b2 patch will still cause a conflict when it's applied after pulling, but you can do the following:\ngit reset --soft HEAD^\ngit stash\ngit pull\ngit stash pop # Will cause a conflict\ngit commit # Re-commit 7826b2\n\nAnother workflow is also possible:\ngit reset --hard HEAD^\ngit pull\ngit cherry-pick 7826b2 # Will cause a conflict\n\nThe second workflow relies on the fact that Git keeps the 7826b2 commit in the reflog (you can think of it as the recycle bin) even though you reset the changes it introduced with the first line."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Android Studio Checkout Github Error \"CreateProcess=2\" (Windows)\n\nToday I've tried to checkout my Github project using brand new Android Studio and ended up with this nasty error :\n\nWhy things just never work out of the box ...?"
},
{
"role": "assistant",
"content": "I've solved the problem , and I will explain how :\n\nDownload Github For Windows client and install it.\nAfter The client successfully installed , connect it with your github account.It should be easy , just follow the wizard.\nThen you should add git.exe location to your \"Path Variable\". The location you should add will probably be something like :\nC:\\Users\\Your_Username\\AppData\\Local\\GitHub\\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\\bin\n\nAlternatively , if you don't want to add to environment variables. You can open the android studio and go to :\nSettings -> Version Control -> Git\nIn text box next to \"Path to Git Executable\" you will see \"git.exe\" , just give it a full path like so :\nC:\\Users\\Your_Username\\AppData\\Local\\GitHub\\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\\bin\\git.exe\nEDIT :\nFor latest Github for windows versions some can find the git.exe under \"...\\cmd\\git.exe\" rather than \"...\\bin\\git.exe\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs %ch"
},
{
"role": "assistant",
"content": "committer date, human style (like the --date=human option of git-rev-list )"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git error: failed to push some refs to remote\nI can't push now, though I could do it yesterday.\nWhen I use git push origin master, I get an error:\n$ git remote -v\norigin https://github.com/REDACTED.git (fetch)\norigin https://github.com/REDACTED.git (push)\n\n$ git push origin master\nUsername for 'https://github.com': REDACTED\nPassword for 'https://[email protected]':\nTo https://github.com/REDACTED.git\n! [rejected] master -> master (non-fast-forward)\nerror: failed to push some refs to 'https://github.com/REDACTED.git'\nhint: Updates were rejected because the tip of your current branch is behind\nhint: its remote counterpart. Integrate the remote changes (e.g.\nhint: 'git pull ...') before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n\nWhat my working directory and remote repository looks like:"
},
{
"role": "assistant",
"content": "(Note: starting Oct. 2020, any new repository is created with the default branch main, not master. And you can rename existing repository default branch from master to main.\nThe rest of this 2014 answer has been updated to use \"main\")\n(The following assumes github.com itself is not down, as eri0o points out in the comments: see www.githubstatus.com to be sure)\nIf the GitHub repo has seen new commits pushed to it, while you were working locally, I would advise using:\ngit pull --rebase\ngit push\n\nThe full syntax is:\ngit pull --rebase origin main\ngit push origin main\n\nWith Git 2.6+ (Sept. 2015), after having done (once)\ngit config --global pull.rebase true\ngit config --global rebase.autoStash true\n\nA simple git pull would be enough.\n(Note: with Git 2.27 Q2 2020, a merge.autostash is also available for your regular pull, without rebase)\nThat way, you would replay (the --rebase part) your local commits on top of the newly updated origin/main (or origin/yourBranch: git pull origin yourBranch).\nSee a more complete example in the chapter 6 Pull with rebase of the Git Pocket Book.\nI would recommend a:\n# add and commit first\n#\ngit push -u origin main\n\n# Or git 2.37 Q2 2022+\ngit config --global push.autoSetupRemote true\ngit push\n\nThat would establish a tracking relationship between your local main branch and its upstream branch.\nAfter that, any future push for that branch can be done with a simple:\ngit push\n\nAgain, with Git 2.37+ and its global option push.autoSetupRemote, a simple git push even for the first one would do the same (I.e: establishing a tracking relationship between your local main branch and its upstream branch origin/main).\nSee \"Why do I need to explicitly push a new branch?\".\n\nSince the OP already reset and redone its commit on top of origin/main:\ngit reset --mixed origin/main\ngit add .\ngit commit -m \"This is a new commit for what I originally planned to be amended\"\ngit push origin main\n\nThere is no need to pull --rebase.\nNote: git reset --mixed origin/main can also be written git reset origin/main, since the --mixed option is the default one when using git reset."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-gc - Cleanup unnecessary files and optimize the local repository --keep-largest-pack"
},
{
"role": "assistant",
"content": "All packs except the largest non-cruft pack, any packs marked\nwith a .keep file, and any cruft pack(s) are consolidated into\na single pack. When this option is used, gc.bigPackThreshold is ignored."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-push - Update remote refs along with associated objects +"
},
{
"role": "assistant",
"content": "for a successful forced update;"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Mirror from github to gitlab\n\nIn Gitlab it is now possible to automatically mirror remote GIT repo:\nhttp://docs.gitlab.com/ee/workflow/repository_mirroring.html\nSynchronization is either done manually or via gitlab cron script (running every hour).\nI would like to sync in this way my github repo and run Gitlab CI jobs using my own runners.\nIs is possible to automatize sync task, i.e. via Github webhooks ? Do you know if there is any other way to do it with Gitlab infrastructure ?\nI would like to avoid hacking like:\n - cloning github repo in gitlab runner\n - running my own cron jobs which do sync more often"
},
{
"role": "assistant",
"content": "Mirror does work, but it's slow. If your goal is to run gitlab-ci for a github repository, good news, gitlab has released a new version which lets you use github.com repository with gitlab-ci:\nhttps://about.gitlab.com/2018/03/22/gitlab-10-6-released/\n\nGitLab CI/CD for GitHub feature a part of our GitLab.com Free tier\n\nInstructions:\n\nhttps://about.gitlab.com/2018/03/22/gitlab-10-6-released/#gitlab-cicd-for-external-repos\nhttps://docs.gitlab.com/ee/ci/ci_cd_for_external_repos/"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-worktree - Manage multiple working trees unlock"
},
{
"role": "assistant",
"content": "Unlock a worktree, allowing it to be pruned, moved or deleted."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-rev-parse - Pick out and massage parameters <rev>^[<n>] , e.g. HEAD^, v1.5.1^0"
},
{
"role": "assistant",
"content": "A suffix ^ to a revision parameter means the first parent of\nthat commit object. ^<n> means the <n>th parent (i.e. <rev>^ is equivalent to <rev>^1 ). As a special rule, <rev>^0 means the commit itself and is used when <rev> is the\nobject name of a tag object that refers to a commit object."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc diff.dstPrefix"
},
{
"role": "assistant",
"content": "If set, git diff uses this destination prefix. Defaults to \"b/\"."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff - Show changes between commits, commit and working tree, etc --ignore-submodules[=<when>]"
},
{
"role": "assistant",
"content": "Ignore changes to submodules in the diff generation. <when> can be\neither \"none\", \"untracked\", \"dirty\" or \"all\", which is the default.\nUsing \"none\" will consider the submodule modified when it either contains\nuntracked or modified files or its HEAD differs from the commit recorded\nin the superproject and can be used to override any settings of the ignore option in git-config or gitmodules . When\n\"untracked\" is used submodules are not considered dirty when they only\ncontain untracked content (but they are still scanned for modified\ncontent). Using \"dirty\" ignores all changes to the work tree of submodules,\nonly changes to the commits stored in the superproject are shown (this was\nthe behavior until 1.7.0). Using \"all\" hides all changes to submodules."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options merge.<driver>.recursive"
},
{
"role": "assistant",
"content": "Names a low-level merge driver to be used when\nperforming an internal merge between common ancestors.\nSee gitattributes for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Meaning of the GitHub message: push declined due to email privacy restrictions\n\nI have accepted and merged a pull request on GitHub, and now I cannot pull my commits any more.\nThe message is:\n! [remote rejected] master -> master (push declined due to email privacy restrictions)\nerror: failed to push some refs to '[email protected]:FranckFreiburger/vue-resize-sensor.git'\n\n\ngit did not exit cleanly (exit code 1) (3838 ms @ 12/04/2017 21:23:11)\n\nWhat should I do now?"
},
{
"role": "assistant",
"content": "The remote repository has been configured to disallow you pushing a commit that would reveal your personal e-mail address. For example in GitHub you have checked the Block command line pushes that expose my email checkbox to enable this.\n\nWhile you can of course uncheck that setting, it will expose your private e-mail address to everyone in the world, as author information is readable by anyone with access to your repository.\nInstead, do this:\n\nYou can see your personal e-mail address, which is used by default for your commits in Git:\ngit config --global user.email\n\nFind your GitHub noreply address in your GitHub's Personal Settings → Emails. It's mentioned in the description of the Keep my email address private checkbox. Usually, it starts with a unique identifier, plus your username:\n{ID}+{username}@users.noreply.github.com\n\n\nChange the global user e-mail address setting to be your GitHub noreply address:\ngit config --global user.email {ID}+{username}@users.noreply.github.com\n\nReset the author information on your last commit:\ngit commit --amend --reset-author\n\nIf you have multiple commits with your private e-mail address, see this answer.\nNow you can push the commit with the noreply e-mail address, and future commits will have the noreply e-mail address as well.\ngit push"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs"
},
{
"role": "assistant",
"content": "Generating patch text with -p Running git-diff , git-log , git-show , git-diff-index , git-diff-tree , or git-diff-files with the -p option produces patch text.\nYou can customize the creation of patch text via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS environment variables\n(see git ), and the diff attribute (see gitattributes ). What the -p option produces is slightly different from the traditional\ndiff format: It is preceded by a \"git diff\" header that looks like this: diff --git a/file1 b/file2 The a/ and b/ filenames are the same unless rename/copy is\ninvolved. Especially, even for a creation or a deletion, /dev/null is not used in place of the a/ or b/ filenames. When a rename/copy is involved, file1 and file2 show the\nname of the source file of the rename/copy and the name of\nthe file that the rename/copy produces, respectively. It is followed by one or more extended header lines: old mode <mode>\nnew mode <mode>\ndeleted file mode <mode>\nnew file mode <mode>\ncopy from <path>\ncopy to <path>\nrename from <path>\nrename to <path>\nsimilarity index <number>\ndissimilarity index <number>\nindex <hash>..<hash> <mode> File modes are printed as 6-digit octal numbers including the file type\nand file permission bits. Path names in extended headers do not include the a/ and b/ prefixes. The similarity index is the percentage of unchanged lines, and\nthe dissimilarity index is the percentage of changed lines. It\nis a rounded down integer, followed by a percent sign. The\nsimilarity index value of 100% is thus reserved for two equal\nfiles, while 100% dissimilarity means that no line from the old\nfile made it into the new one. The index line includes the blob object names before and after the change.\nThe <mode> is included if the file mode does not change; otherwise,\nseparate lines indicate the old and the new mode. Pathnames with \"unusual\" characters are quoted as explained for\nthe configuration variable core.quotePath (see git-config ). All the file1 files in the output refer to files before the\ncommit, and all the file2 files refer to files after the commit.\nIt is incorrect to apply each change to each file sequentially. For\nexample, this patch will swap a and b: diff --git a/a b/b\nrename from a\nrename to b\ndiff --git a/b b/a\nrename from b\nrename to a Hunk headers mention the name of the function to which the hunk\napplies. See \"Defining a custom hunk-header\" in gitattributes for details of how to tailor this to\nspecific languages."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs <paths>"
},
{
"role": "assistant",
"content": "Commits modifying the given <paths> are selected."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-checkout - Switch branches or restore working tree files -f --force"
},
{
"role": "assistant",
"content": "When switching branches, proceed even if the index or the\nworking tree differs from HEAD , and even if there are untracked\nfiles in the way. This is used to throw away local changes and\nany untracked files or directories that are in the way. When checking out paths from the index, do not fail upon unmerged\nentries; instead, unmerged entries are ignored."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Telling if a Git commit is a Merge/Revert commit\nI am writing a script that requires checking whether a particular commit is a Merge/Revert commit or not, and I am wondering if there is a git trick for that.\nWhat I came up with so far (and I definitely don't want to depend on the commit message here) is to check HASH^2 and see if I don't get an error, is there a better way?"
},
{
"role": "assistant",
"content": "Figuring out if something is a merge is easy. That's all commits with more than one parent. To check for that, you can do, for example\n$ git cat-file -p $commit_id\n\nIf there's more than one `parent' line in the output, you found a merge.\nFor reverts it's not as easy. Generally reverts are just normal commits that happen to apply the diff of a previous commit in reverse, effectively removing the changes that commit introduced. They're not special otherwise.\nIf a revert was created with git revert $commit, then git usually generates a commit message indication the revert and what commit it reverted. However, it's quite possible to do reverts in other ways, or to just change the commit message of a commit generated by git revert.\nLooking for those generated revert commit message might already be a good enough heuristic for what you're trying to achieve. If not, you'd have to actually look through other commits, comparing their diffs against each other, checking if one is the exact reverse operation of another. But even that isn't a good solution. Often enough reverts are slightly different than just the reverse of the commit they're reverting, for example to accommodate for code changes that happened between the commit and the revert."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-update-index - Register file contents in the working tree to the index --split-index --no-split-index"
},
{
"role": "assistant",
"content": "Enable or disable split index mode. If split-index mode is\nalready enabled and --split-index is given again, all\nchanges in $GIT_DIR/index are pushed back to the shared index\nfile. These options take effect whatever the value of the core.splitIndex configuration variable (see git-config ). But a warning is\nemitted when the change goes against the configured value, as the\nconfigured value will take effect next time the index is read and this\nwill remove the intended effect of the option."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to find which git branch I am on when my disk is mounted on other server\nOur git repo is on a Linux server; I can be on the master branch or create a new branch that I can go inside and use.\nOur git repo disk is mounted on AIX box to build (I can see git directory in the AIX box that allows me to build)\nIn the AIX box how I can see that I am using master or inside a particular branch. What changes inside .git that drives which branch I am on?"
},
{
"role": "assistant",
"content": "git branch with no arguments displays the current branch marked with an asterisk in front of it:\nuser@host:~/gittest$ git branch\n* master\n someotherbranch\n\nIn order to not have to type this all the time, I can recommend git prompt:\nhttps://github.com/git/git/blob/master/contrib/completion/git-prompt.sh\n\nIn the AIX box how I can see that I am using master or inside a particular branch. What changes inside .git that drives which branch I am on?\n\nGit stores the HEAD in the file .git/HEAD. If you're on the master branch, it could look like this:\n$ cat .git/HEAD\nref: refs/heads/master"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options diff.<driver>.textconv"
},
{
"role": "assistant",
"content": "The command that the diff driver should call to generate the\ntext-converted version of a file. The result of the\nconversion is used to generate a human-readable diff. See gitattributes for details."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Error \"The authenticity of host 'github.com' can't be established. RSA key fingerprint \"\n\nI use my project at work, but I would like to work with him from home as I can log into my home machine to work with my project.\nHowever, from home, I see the following message:\nThe authenticity of host 'github.com (ip)' can't be established.\nRSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.\nAre you sure you want to continue connecting (yes/no)?\n\nHow can I get past it?"
},
{
"role": "assistant",
"content": "You should simply be able to answer 'yes', which will update your ~/.ssh/known_hosts file.\n\nA better approach, to avoid any MITM (Man-In-The-Middle) attack, would be (as commented below by Mamsds) to verify GitHub's public key first (see \"GitHub's SSH key fingerprints\") and, if you find a match, then you can answer 'yes'.\nExample:\nssh-keyscan -t ecdsa github.com 2>&1 |ssh-keygen -lf -\n256 SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s github.com (ECDSA)\n\n\nAfter that, you can use a GitHub SSH URL (provided you have generated the SSH public/private keys, and registered the public one to your GitHub profile)\nNote: the ssh key generation should use the base64 old PEM format (option -m PEM), rather than the new current 70 chars OpenSSH one.\nSee \"What is the correct format for private key in Credentials\":\nssh-keygen -m PEM -t rsa -P \"\" -f afile\n\nThat or you can switch to an HTTPS URL.\n\nUpdate March 2023:\nGitHub updated their RSA SSH host key\n\nAt approximately 05:00 UTC on March 24, out of an abundance of caution, we replaced our RSA SSH host key used to secure Git operations for GitHub.com.\nWe did this to protect our users from any chance of an adversary impersonating GitHub or eavesdropping on their Git operations over SSH. This key does not grant access to GitHub’s infrastructure or customer data. This change only impacts Git operations over SSH using RSA.\nWeb traffic to GitHub.com and HTTPS Git operations are not affected.\nOnly GitHub.com’s RSA SSH key was replaced. No change is required for ECDSA or Ed25519 users\nIf you see the following message when connecting to GitHub.com via SSH, then read onward.\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\nIT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\nIt is also possible that a host key has just been changed.\nThe fingerprint for the RSA key sent by the remote host is\nSHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.\nPlease contact your system administrator.\nAdd correct host key in ~/.ssh/known_hosts to get rid of this message.\nHost key for github.com has changed and you have requested strict > checking.\nHost key verification failed.\n\nIf you see the above message, you’ll need to remove the old key by running this command:\n$ ssh-keygen -R github.com\n\nOr manually updating your ~/.ssh/known_hosts file to remove the old entry.\nThen, you can manually add the following line to add the new RSA SSH public key entry to your ~/.ssh/known_hosts file:\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=\n\nOr automatically update GitHub.com’s RSA SSH key in your ~/.ssh/known_hosts, by running the following in your terminal:\n$ ssh-keygen -R github.com\n$ curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | sed -e 's/^/github.com /' >> ~/.ssh/known_hosts\n\n\nOr, without jq, for Mac or Windows users :\ncurl -L https://api.github.com/meta | grep ssh-rsa | \\\n awk '{print \"github.com\", $2}' >> ~/.ssh/known_hosts\n\n\nYou can verify that your hosts are connecting via our new RSA SSH key by confirming that you see the following fingerprint:\nSHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s\n\nGitHub Actions users may see failed workflow runs if they are using actions/checkout with the ssh-key option.\nWe are updating the actions/checkout action in all our supported tags, including @v2, @v3, and @main.\nIf you pin the action to a commit SHA and use the ssh-key option, you’ll need to update your workflow. You can read more about this process in our official documentation for Actions security hardening.\nFor more information, please visit our official documentation on GitHub’s SSH public key fingerprints.\n\nSo:\n\nWhat happened and what actions have we taken?\nThis week, we discovered that GitHub.com’s RSA SSH private key was briefly exposed in a public GitHub repository.\nWe immediately acted to contain the exposure and began investigating to understand the root cause and impact.\nWe have now completed the key replacement, and users will see the change propagate over the next thirty minutes.\nSome users may have noticed that the new key was briefly present beginning around 02:30 UTC during preparations for this change.\nPlease note that this issue was not the result of a compromise of any GitHub systems or customer information.\nInstead, the exposure was the result of what we believe to be an inadvertent publishing of private information. We have no reason to believe that the exposed key was abused, and took this action out of an abundance of caution.\n\n\nAs noted by bk2204'sanswer:\n\nSome versions of OpenSSH include the host key for the IP address as well as for the hostname.\nThis is rather unhelpful, as IP addresses can change with DNS, but hostname tend to be more stable.\nTo remove the old key entirely:\n\n# linux\nsed -i -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31\\/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi\\/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==/d' ~/.ssh/known_hosts\n\n# MacOS\nsed -i '' -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31\\/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi\\/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==/d' ~/.ssh/known_hosts\n\n# Windows\nsed -i -e \"/AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31\\/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi\\/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==/d\" %USERPROFILE%\\.ssh\\known_hosts\n\nThe last command (for Windows) can be done with the %PATH% modified with:\nset \"GH=%ProgramFiles%\\Git\"\nset \"PATH=%GH%\\bin;%GH%\\cmd;%GH%\\usr\\bin;%GH%\\mingw64\\bin;%GH%\\mingw64\\libexec\\git-core;%PATH%\"\n\n\nTo remove any GitHub IP address from your known_hosts file, see discussion 50878:\n\nFor anyone running into repeated ECDSA host key for 'github.com' differs from the key for the IP address / Offending key for IP issues and you can't grep IPs in known_hosts because you have hashed entries, I have created a Gist listing all Github git IPv4 addresses (as of Fri Mar 24 16:33:22 UTC 2023), generated from CIDRs listed in https://api.github.com/meta:\nhttps://gist.github.com/a-abella/fb31a028943b804e8ada6cda4efbe9b6\nYou can loop over these and feed them to ssh-keygen -R.\nA script with optional known_hosts file path argument is available here: https://gist.github.com/a-abella/9d6c91a56a892e4c74933d17d380aa01. The only dependency is curl.\nIf you want a one-liner (though the standard you-shouldn't-pipe-scripts-from-the-internet warnings apply):\ncurl -s https://gist.githubusercontent.com/a-abella/9d6c91a56a892e4c74933d17d380aa01/raw/0bcaef131f94e4938cb659d744c3019fd814643e/strip_github.sh | bash -s -- $HOME/.ssh/known_hosts"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker GIT_PAGER"
},
{
"role": "assistant",
"content": "This environment variable overrides $PAGER . If it is set\nto an empty string or to the value \"cat\", Git will not launch\na pager. See also the core.pager option in git-config ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Image not showing up in README.md on GitHub\n\nI am trying to add an image to the README.md in my repository using markdown below:\n\n\nBut the image is not showing when I visit my repository. \nInstead the link to the image is showing up. Clicking the link will open the image in new window.\nI have also tried using relative path:\n\n\nBut this is giving page not found error.\nWhat is the correct markdown to display image in README.md\nBoth README.md and image file are in same path/directory.\nWhat is the correct way to display an image in github README.md?\nComplete content of README.md file is as below:\nVoice-controlled-MP3-Player\n===========================\n\nA MP3 player which accept voice command like PLAY, PAUSE, FORWARD, etc. Using C# and Microsoft Speech API.\n\n"
},
{
"role": "assistant",
"content": "Updated content\nSince January, 30th 2013, GitHub now supports relative links in markup documents.\nThis means that your code  would now work flawlessly.\nAs pointed by @Brad, this may also ease a scenario where the images are different in two branches, but bear the same. In that case, switching from one branch to another, would dynamically switch the image in the rendered view, thus without requiring any change to the Readme content.\n\nBlog post announcement\nHelp article\n\nPrevious answer when GitHub wasn't supporting relative links\nYou have to use the raw url format. In your case that would be https://raw.githubusercontent.com/i-saumitra/Voice-controlled-MP3-Player/master/screenshot.jpg\nThis means that the correct markdown would be the following\n\n\nUsing this in a .mdfile on github will display the following picture ;-)\n\nUpdate following your comment\n\nwhere is this officialy documented that we have to use raw...i couldn't find it anywhere\n\nThis URL format is an undocumented feature of the GitHub site. This means that it could change later. If that ever happens, in order to \"rediscover\" the new format, click the Raw button when displaying a image. This will \"open\" the image in your browser. Copy the URL and Voilà!\n\nNote: Although the repository is no longer on hosted on GitHub, I've updated the urls to reflect the new GitHub policy regarding user content"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Pushing code from one branch of a repo to another branch of another repo\nThere is a repo say ABC/A. I had forked this repo to my own github say ME/A. I was asked to create a branch on ME/A say x (originally there were develop and master). I had to write some code, so I cloned ABC/A and worked on its develop branch. But now when I have to push the code, I cannot push it to ABC/A as i dont have rights to do so. I have to push the code to ME/A. The problem is, I worked on develop branch for ABC/A but I have to push the code to ME/A x branch. Is it possible to push code in such a way?"
},
{
"role": "assistant",
"content": "Yes, you can push any local branch to any remote branch. The syntax is\ngit push <remote name, e.g. origin> <local branch name>:<remote branch name>\n\nIf your current branch (the one you want to push) is called develop, the command would be\ngit push ME develop:x"
}
] |
[
{
"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"
},
{
"role": "assistant",
"content": "THE DEFAULT FORMAT When neither --porcelain nor --incremental option is specified, git blame will output annotation for each line with: abbreviated object name for the commit the line came from; author ident (by default the author name and date, unless -s or -e is specified); and line number before the line contents."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Default behavior of \"git push\" without a branch specified\nI use the following command to push to my remote branch:\ngit push origin sandbox\n\nIf I say\ngit push origin\n\ndoes that push changes in my other branches too, or does it only update my current branch? I have three branches: master, production and sandbox.\nThe git push documentation is not very clear about this, so I'd like to clarify this for good.\nWhich branches and remotes do the following git push commands update exactly?\ngit push \ngit push origin\n\norigin above is a remote.\nI understand that git push [remote] [branch] will push only that branch to the remote."
},
{
"role": "assistant",
"content": "You can control the default behavior by setting push.default in your git config. From the git-config(1) documentation:\npush.default\n\nDefines the action git push should take if no refspec is given on the command line, no refspec is configured in the remote, and no refspec is implied by any of the options given on the command line. Possible values are:\n\nnothing: do not push anything\n\nmatching: (default before Git 2.0) push all matching branches\nAll branches having the same name in both ends are considered to be matching.\n\nupstream: push the current branch to its upstream branch (tracking is a deprecated synonym for upstream)\n\ncurrent: push the current branch to a branch of the same name\n\nsimple: (new in Git 1.7.11, default since Git 2.0) like upstream, but refuses to push if the upstream branch's name is different from the local one\nThis is the safest option and is well-suited for beginners.\n\n\n\nThe simple, current and upstream modes are for those who want to push out a single branch after finishing work, even when the other branches are not yet ready to be pushed out\n\nCommand line examples:\nTo view the current configuration:\ngit config push.default\n\nTo set a new configuration:\ngit config push.default current"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-fetch - Download objects and refs from another repository +"
},
{
"role": "assistant",
"content": "for a successful forced update;"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to stash my previous commit?\nI've got the following situation on my git log:\ncommit 111 <-- need to push it to the repository\n\ncommit 222 <-- need to stash this one\n\n...\n\nAs you can see, I need to push only last (without previous) commit to repository.\nHow can I do it? git revert --soft commit_hash will help me?"
},
{
"role": "assistant",
"content": "If you've not pushed either commit to your remote repository, you could use interactive rebasing to 'reorder' your commits and stash the (new) most recent commit's changes only.\nAssuming you have the tip of your current branch (commit 111 in your example) checked out, execute the following:\ngit rebase -i HEAD~2\n\nThis will open your default editor, listing most recent 2 commits and provide you with some instructions. Be very cautious as to what you do here, as you are going to effectively 'rewrite' the history of your repository, and can potentially lose work if you aren't careful (make a backup of the whole repository first if necessary). I've estimated commit hashes/titles below for example\npick 222 commit to be stashed\npick 111 commit to be pushed to remote\n\n# Rebase 111..222 onto 333\n#\n# Commands:\n# p, pick = use commit\n# r, reword = use commit, but edit the commit message\n# e, edit = use commit, but stop for amending\n# s, squash = use commit, but meld into previous commit\n# f, fixup = like \"squash\", but discard this commit's log message\n# x, exec = run command (the rest of the line) using shell\n#\n# These lines can be re-ordered; they are executed from top to bottom.\n#\n# If you remove a line here THAT COMMIT WILL BE LOST.\n#\n# However, if you remove everything, the rebase will be aborted.\n#\n# Note that empty commits are commented out\n\nReorder the two commits (they are listed oldest => newest) like this:\npick 111 commit to be pushed to remote\npick 222 commit to be stashed\n\nSave and exit, at which point git will do some processing to rewrite the two commits you have changed. Assuming no issues, you should have reversed the order of your two changesets. This can be confirmed with git log --oneline -5 which will output newest-first.\nAt this point, you can simply do a soft-reset on the most recent commit, and stash your working changes:\ngit reset --soft HEAD~1\ngit stash\n\nIt's important to mention that this option is only really viable if you have not previously pushed any of these changes to your remote, otherwise it can cause issues for everyone using the repository."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab CI with JS Linting\n\nI have 0 experience with GitLab Continuous Integration and I need to setup a job to run ESLint on .js files.\nI've already read the GitLab CI and Pipeline documentations, along with some Git Hooks, but I still have no idea how to setup this, so any detailed and starting from the very beginning answer is appreciated."
},
{
"role": "assistant",
"content": "First you need to setup your CI and have some runners available so they can run your continuous integration jobs. The easiest way for this is to use gitlab-ci-multi-runner (project is here along with documentation) along with the docker executor that will run your CI jobs in docker containers. Once you have configured some runners, add them to your Gitlab project so they're available to run jobs.\nOnce that's taken care of, you need to add a .gitlab-ci.yml file to your project. This file is used to describe the jobs that need to run during continuous integration etc. Here is an example (assuming you install eslint using npm)\nimage: node:latest\n\nstages:\n - lint\n\neslint:\n stage: lint\n script:\n # Install ESLint in this docker container\n - npm install -g eslint\n # Configure ESLint (will read your .eslintrc file)\n - eslint --init\n # Run ESLint\n - eslint <your_js_file>\n\nAdd your .gitlab-ci.yml file, commit and push the changes. The CI pipeline should start and run the above steps."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-diff-index - Compare a tree to the working tree or index --color[=<when>]"
},
{
"role": "assistant",
"content": "Show colored diff. --color (i.e. without =<when> ) is the same as --color=always . <when> can be one of always , never , or auto ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs -G<regex>"
},
{
"role": "assistant",
"content": "Look for differences whose patch text contains added/removed\nlines that match <regex>. To illustrate the difference between -S<regex> --pickaxe-regex and -G<regex> , consider a commit with the following diff in the same\nfile: + return frotz(nitfol, two->ptr, 1, 0);\n...\n- hit = frotz(nitfol, mf2.ptr, 1, 0); While git log -G\"frotz\\(nitfol\" will show this commit, git log\n-S\"frotz\\(nitfol\" --pickaxe-regex will not (because the number of\noccurrences of that string did not change). Unless --text is supplied patches of binary files without a textconv\nfilter will be ignored. See the pickaxe entry in gitdiffcore for more\ninformation."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-check-ignore - Debug gitignore / exclude files"
},
{
"role": "assistant",
"content": "SYNOPSIS git check-ignore [<options>] <pathname>… git check-ignore [<options>] --stdin"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-filter-branch - Rewrite branches --parent-filter <command>"
},
{
"role": "assistant",
"content": "This is the filter for rewriting the commit’s parent list.\nIt will receive the parent string on stdin and shall output\nthe new parent string on stdout. The parent string is in\nthe format described in git-commit-tree : empty for\nthe initial commit, \"-p parent\" for a normal commit and\n\"-p parent1 -p parent2 -p parent3 …\" for a merge commit."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options push.autoSetupRemote"
},
{
"role": "assistant",
"content": "If set to \"true\" assume --set-upstream on default push when no\nupstream tracking exists for the current branch; this option\ntakes effect with push.default options simple , upstream ,\nand current . It is useful if by default you want new branches\nto be pushed to the default remote (like the behavior of push.default=current ) and you also want the upstream tracking\nto be set. Workflows most likely to benefit from this option are simple central workflows where all branches are expected to\nhave the same name on the remote."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to combine rules in gitlab ci/cd\n\nI would like to create rule for:\nchanges in folder foo && branch = master && tag pushed\nMy current rules not working:\n rules:\n - if: $CI_COMMIT_TAG && '$CI_COMMIT_BRANCH == \"master\"'\n - changes:\n - foo/**/*\n\nLooks like gitlab take like a OR.\nWhat is wrong?"
},
{
"role": "assistant",
"content": "As stated in the gitlab documentation:\n\nTo conjoin if, changes, and exists clauses with an AND, use them in the same rule.\n\nSo it should be:\n rules:\n - if: $CI_COMMIT_TAG && '$CI_COMMIT_BRANCH == \"master\"'\n changes:\n - foo/**/*"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Is it possible to do a Git Pull --rebase with Visual Studio git tools (and can it be set by default)\nFirst, as the title says, is it even possible in a single step (i.e. not fetch then rebase), to do a pull --rebase? \nSecond, is a setting in Visual Studio to force the built-in Team Explorer git tools to always do a pull --rebase rather than a standard pull (fetch/merge).\nI am aware you could set the default in the global or project config files with git config branch.autosetuprebase always, but I wanted to specifically find out if Visual Studio could update/change that setting or had a similar option, like most other GUIs have. I haven't been able to find anything, so it seems like it doesn't, hence the question."
},
{
"role": "assistant",
"content": "In VS2017 you can use built-in feature to change git settings for rebase: go to Team Explorer -> Home -> Settings -> Global Settings or Repository Settings -> set Rebase local branch when pulling: True (screenshot)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-clone - Clone a repository into a new directory -c <key> = <value> --config <key> = <value>"
},
{
"role": "assistant",
"content": "Set a configuration variable in the newly-created repository;\nthis takes effect immediately after the repository is\ninitialized, but before the remote history is fetched or any\nfiles checked out. The <key> is in the same format as expected by git-config (e.g., core.eol=true ). If multiple\nvalues are given for the same key, each value will be written to\nthe config file. This makes it safe, for example, to add\nadditional fetch refspecs to the origin remote. Due to limitations of the current implementation, some configuration\nvariables do not take effect until after the initial fetch and checkout.\nConfiguration variables known to not take effect are: remote. <name> .mirror and remote. <name> .tagOpt . Use the\ncorresponding --mirror and --no-tags options instead."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "When should I create a new branch?\nI am starting a new project, and to experiment a little bit with the technologies used in the project (hello world examples...) I want to create something like a \"playground\" branch. Is it common to create a new branch \"playground\" or should I just create a folder named \"playground\" in the master branch?"
},
{
"role": "assistant",
"content": "You should create a new branch when you're doing development work that is somewhat experimental in nature. So in your scenario definitely create a new branch and not a folder within master. If you created your sandbox work as a directory in the master, it's going to reside there until you remove it using git. Having dead code sitting in the master branch is not ideal by any means, since it can confuse other developers and may just sit there rotting for the lifetime of the application.\nIf your team were to experience a bug, you wouldn't want them to waste time exploring the experimental work to determine if the bug existed within that directory. Creating a new branch allows you to isolate your changes from the master branch. If your experimentation goes well you always have the option to merge your changes into the master branch. If things don't go so well you can always discard the branch or keep it within your local repository."
}
] |
[
{
"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 --literally"
},
{
"role": "assistant",
"content": "Allow --stdin to hash any garbage into a loose object which might not\notherwise pass standard object parsing or git-fsck checks. Useful for\nstress-testing Git itself or reproducing characteristics of corrupt or\nbogus objects encountered in the wild."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git --oneline"
},
{
"role": "assistant",
"content": "our version of --pretty=oneline"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --all"
},
{
"role": "assistant",
"content": "Pretend as if all the refs in refs/ , along with HEAD , are\nlisted on the command line as <commit> ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "difference between .gitmodules and specifying submodules in .git/config?\nProbably very silly question, - but I've been specifying submodules up until now in .gitmodules file. It recently struck me that perhaps it's possible to just use .git/config for the same reason so I won't have to keep extraneous file in working directory? \n.git/config :\n[submodule \"path/to/repo\"]\n url = [email protected]:username/repo.git\n\n.gitmodules\n[submodule \"path/to/repo\"]\n path = path/to/repo\n url = [email protected]:username/repo.git\n\nAre these basically the same things?"
},
{
"role": "assistant",
"content": "Same answer than .git/info/exclude and .gitignore.\nThe .gitmodules file can be included in the repository and shared with everyone (that is, it can be added and committed like any regular file), whereas anything in .git (like .git/config) is private (you cannot add it in the repository)."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git: list only \"untracked\" files (also, custom commands)\nIs there a way to use a command like git ls-files to show only untracked files?\nThe reason I'm asking is because I use the following command to process all deleted files:\ngit ls-files -d | xargs git rm\n\nI'd like something similar for untracked files:\ngit some-command --some-options | xargs git add\n\nI was able to find the -o option to git ls-files, but this isn't what I want because it also shows ignored files. I was also able to come up with the following long and ugly command:\ngit status --porcelain | grep '^??' | cut -c4- | xargs git add\n\nIt seems like there's got to be a better command I can use here. And if there isn't, how do I create custom git commands?"
},
{
"role": "assistant",
"content": "To list untracked files try:\ngit ls-files --others --exclude-standard\n\nIf you need to pipe the output to xargs, it is wise to mind white spaces using git ls-files -z and xargs -0:\ngit ls-files -z -o --exclude-standard | xargs -0 git add\n\nNice alias for adding untracked files:\nau = !git add $(git ls-files -o --exclude-standard)\n\nEdit: For reference: git-ls-files"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-send-email - Send a collection of patches as emails --cc-cmd=<command>"
},
{
"role": "assistant",
"content": "Specify a command to execute once per patch file which\nshould generate patch file specific \"Cc:\" entries.\nOutput of this command must be single email address per line.\nDefault is the value of sendemail.ccCmd configuration value."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --remove-empty"
},
{
"role": "assistant",
"content": "Stop when a given path disappears from the tree."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Merging between forks in GitHub\n\nI forked a GitHub repository. Then I pushed some changes to my fork. Then the original repository merged my changes and some others. Now, I want to merge those changes I'm missing. I tried a simple pull followed by push, but this yield my commits in duplicate. What's the best way to do it?"
},
{
"role": "assistant",
"content": "You probably have a \"remote\" for each repository. You need to pull from one remote and push to the other.\nIf you originally cloned from your fork, that remote will be called \"origin\". If you haven't added it already, you'll need to add the other repository as another remote:\ngit remote add <shortname> git://github.com/<ownerName>/repo.git\n\nAfter that's all set up, you should indeed be able to (github changed default branch from master to main, change as necessary)\ngit pull <shortname> master\ngit push origin\n\nRemember, git pull is nothing more than a macro that does git fetch and git merge, in that order. You just need to fetch the list of commits from the other repository and then merge his branch into your tree. Merging should do the right thing with your commits on both branches.\nGitHub, in all its perpetual awesomeness, gives you a shortcut, of course. There's a \"fast-forward\" button on your fork of the repository that you can use to catch your fork up if you're entirely merged into the other side."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-svn - Bidirectional operation between a Subversion repository and Git --ignore-paths=<regex>"
},
{
"role": "assistant",
"content": "When passed to init or clone this regular expression will\nbe preserved as a config key. See fetch for a description\nof --ignore-paths ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Connect a local repository with a remote repository\nI have a local repository. I created the whole application, but now I want to push it to a remote repository. I already have remote repo as well. How can I connect these two repositories without losing any work that I did?"
},
{
"role": "assistant",
"content": "Use:\ngit remote add origin <remote_repo_URL>\ngit push --all origin\n\nIf you want to set all of your branches to automatically use this remote repository when you use git pull, add --set-upstream to the push:\ngit push --all --set-upstream origin"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GitLab-CI Multi Runner php composer cache\n\nI'm using gitlab-ci-multi-runner with docker containers. Everything is going fine, but docker containers don't keep the composer cache so in every run composer downloads dependencies again and again, which takes a lot of time. Is there any way to configure gitlab-ci-runner docker container to keep the composer cache or mount a volume on each run where the composer cache is kept?"
},
{
"role": "assistant",
"content": "You can change the composer cache path by exporting the COMPOSER_CACHE_DIR environment variable in your runner configuration file, and then add a volume in the [runners.docker] section to match it.\nIf you run gitlab-runner as root or with sudo, then your configuration file is located at /etc/gitlab-runner/config.toml. Otherwise it's located at $HOME/.gitlab-runner/config.toml.\n# config.toml\n\n[[runners]]\n name = \"Generic Docker Runner\"\n ...\n environment = [\"COMPOSER_CACHE_DIR=/cache\"]\n executor = \"docker\"\n [runners.docker]\n ...\n volumes = [\"/var/cache:/cache:rw\"]\n cache_dir = \"/cache\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Undo a fast-forward merge\nI've made some changes to my git repo that I wish to undo.\nMy git repo looked like this:\nA-B---- master\n \\ /\n C-D * develop\n\nI was on the develop branch, forgot that it differed from the master branch, made a change on develop, merged it into master, and then pushed to my remote (called publish).\nBecause there were no changes on master since B (common ancestor), git did a fast-forward merge.\nNow, my repo looks like this:\nA-B-C-D master, develop, remotes/publish/master, remotes/publish/develop.\n\nI wanted to revert the last merge, restoring master to B.\nFrom what I read in How to undo last commit(s) in Git?, I used git reset sha-of-B to restore my master branch to revision B.\nQuestions:\n\nHow do I restore develop to revision D?\nHow do I then push these changes back to remote/publish?"
},
{
"role": "assistant",
"content": "If you reset the branch master, it won't touch develop branch. In order to reput all in order, you should do:\ngit checkout master\ngit reset --hard sha-of-B\ngit checkout develop\ngit reset --hard sha-of-D\ngit checkout master\ngit merge develop --no-ff"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Prevent commits in master branch\n(For simplicity) I have a master branch and a dev in my Git repository. I want to ensure the master branch is always working, so all work I do should be in the dev branch.\nHowever, when I merge my changes in with a --no-ff merge, I tend to stay in the master branch, and just continue working in it (because I forget to checkout my dev branch).\nCan I put up a rule for the master branch, which states I can't do commits, and fast-forward merges, but only --no-ff merges from another branch?\nThis must work for private hosted repositories (ergo, not GitHub or Bitbucket)."
},
{
"role": "assistant",
"content": "Yes, it is possible. You must create a pre-commit hook which rejects commits to the master branch. Git doesn't call a pre-commit hook when you call the merge command, so this hook will be rejecting only regular commits.\n\nGo to your repository.\n\nCreate a file, .git/hooks/pre-commit, with the following content:\n#!/bin/bash\n\nbranch=\"$(git rev-parse --abbrev-ref HEAD)\"\n\nif [ \"$branch\" = \"master\" ]; then\n echo \"You can't commit directly to master branch\"\n exit 1\nfi\n\n\nMake it executable (not required on Windows):\nchmod +x .git/hooks/pre-commit\n\n\n\nTo disable fast-forward merges, you must also add the following option to your .git/config file:\n[branch \"master\"]\n mergeoptions = --no-ff\n\nIf you want also protect the master branch on your remote, check this answer: How to restrict access to master branch in Git"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Only use a proxy for certain git urls/domains?\nIs it possible to configure git to use a proxy only for specific domains?\nI'd like to use our corporate proxy to access Github but leave it off for accessing our own internal git repos.\nI'm using bower and it needs to require items both within our firewall and on github so I can't do this as a per project setting. It needs to be some kind of global configuration option. Any thoughts?"
},
{
"role": "assistant",
"content": "To add another possibility, you can define a proxy through the git config http.proxy.\ngit config --global http.proxy http://mydomain\\\\myusername:mypassword@myproxyserver:proxyport\n\nBut what is really neat is, starting git1.8.5 (October 2013), you can set http settings per url.\nThe \"http.*\" variables can now be specified per URL that the configuration applies.\nFor example,\n[http]\n sslVerify = true\n[http \"https://weak.example.com/\"]\n sslVerify = false\n\n\nwould flip http.sslVerify off only when talking to that specified site.\n\n\nSee commit d4770964d5:\n$ git config --bool --get-urlmatch http.sslVerify https://good.example.com\ntrue\n$ git config --bool --get-urlmatch http.sslVerify https://weak.example.com\nfalse\n\n\nWith only <section> specified, you can get a list of all variables in the section with their values that apply to the given URL. E.g\n\n$ git config --get-urlmatch http https://weak.example.com\nhttp.sslverify false\n\n\nAll the details are in commit 6a56993b:\nhttp.<url>.*::\n\n\nAny of the http.* options above can be applied selectively to some urls.\n For a config key to match a URL, each element of the config key is compared to that of the URL, in the following order:\n\n\nScheme (e.g., https in https://example.com/).\nHost/domain name (e.g., example.com in https://example.com/).\nPort number (e.g., 8080 in http://example.com:8080/).\nPath (e.g., repo.git in https://example.com/repo.git). \nUser name (e.g., user in https://[email protected]/repo.git)\n\n\nThe list above is ordered by decreasing precedence; a URL that matches a config key's path is preferred to one that matches its user name.\n For example, if the URL is https://[email protected]/foo/bar a config key match of https://example.com/foo will be preferred over a config key match of https://[email protected].\nAll URLs are normalized before attempting any matching (the password part, if embedded in the URL, is always ignored for matching purposes) so that equivalent urls that are simply spelled differently will match properly. \nEnvironment variable settings always override any matches.\n The urls that are matched against are those given directly to Git commands.\n This means any URLs +visited as a result of a redirection do not participate in matching."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Gitlab-CI, run on schedule but only if there are changes\n\nI'd like to deploy my project once per day, but only if there have been changes.\nThere is a specific hour each that I am able to deploy during and I am comfortable with using a scheduled pipeline to trigger and deploy.\nHowever, there aren't always changes that require deployment. Ideally, if there have been no changes to the code base since the last deployment, the pipeline wouldn't run that day.\nIs there any way to achieve this behaviour?"
},
{
"role": "assistant",
"content": "This is similar to a 4 years old feature request gitlab-org/gitlab-foss issue 19813\n\nGitLab CI only execute when a certain folder has changed\nI have quite a large project, and I'm using GitLab CI with Pages to deploy it, however, when I change anything in the repo, it runs CI.\nI don't want this to happen, I want it to run only if the src folder changes.\nIs this possible?\n\nThe recent (July 2020) conclusion is to use only:changes/except:changes\n\nUsing the changes keyword with only or except makes it possible to define if a job should be created based on files modified by a Git push event.\n\nExample:\n\nI wanted this feature especially for package.json and package-lock.json because I can run npm install only if there is changes.\n\n only:\n changes:\n - package.json\n - package-lock.json\n\nWarning, as noted by Matthijs Bierman in the comments, and as documented here:\n\nNote that only: changes does not work with when: scheduled"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options command"
},
{
"role": "assistant",
"content": "GIT_CONFIG_{COUNT,KEY,VALUE} environment variables (see ENVIRONMENT below) the -c option"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How to use the GitHub Actions `workflow_run` event?\n\nAnother frequently-requested feature for Actions is a way to trigger one workflow based on the completion of another workflow. For example, you may want to take the results of a CI workflow and run some further analysis.\nThe new workflow_run event enables you to trigger a new workflow when one or more workflows are requested or completed. Runs triggered by the workflow_run event always use the default branch for the repository, and have access to a read/write token as well as secrets. As an example, as a maintainer you could set up a workflow that takes the artifacts generated by the pull request workflow, do some analysis, and post comments back to the pull request. This event is also available as a webhook and works all repos.\n\nThis is quoted from Github's blog.\nCould anybody tell me how to implement the example proposed using the new event workflow_run? The documentation only provide a very simple example:\non:\n workflow_run:\n workflows: [\"Run Tests\"]\n branches: [main]\n types: \n - completed\n - requested\n\nI would be very glad if someone can teach me how to achieve the example."
},
{
"role": "assistant",
"content": "To get the example to work (i.e. to have one workflow wait for another to complete) you need two files. Both files live in the .github/workflows folder of a repository.\nThe first file would be set up as usual. This file will be triggered by whatever event(s) are set in the on section:\n---\nname: Preflight\n\non:\n - pull_request\n - push\n\njobs:\n preflight-job:\n name: Preflight Step\n runs-on: ubuntu-latest\n steps:\n - run: env\n\nThe second file states that it should only trigger on the workflow_run event for any workflows with the name Preflight:\n---\nname: Test\n\non:\n workflow_run:\n workflows:\n - Preflight\n types:\n - completed\n\njobs:\n test-job:\n name: Test Step\n runs-on: ubuntu-latest\n steps:\n - run: env\n\nThis more-or-less the same as the example from the GitHub Actions manual.\nAs you can see on the actions page\nof my example repo, the Preflight workflow will run first. After it has completed, the Test workflow will be triggered:\n\nAs you can also see, the branch does not appear for the \"Test\" workflow.\nThis is because, (quoting from the manual):\n\n\nThis event will only trigger a workflow run if the workflow file is on the default branch.\n\nThis means that the \"Test\" workflow will run on/with the code from the default branch (usually main or master).\nThere is a workaround for this...\nEvery actions is run with a set of contexts. The github context holds information about the event that triggered the workflow. This includes the branch that the event was originally triggered from/for: github.event.workflow_run.head_branch.\nThis can be used to check out the origination branch in the action, using the actions/checkout action provided by GitHub.\nTo do this, the Yaml would be:\n---\nname: Test\n\non:\n workflow_run:\n workflows:\n - Preflight\n types:\n - completed\n\njobs:\n test-job:\n name: Test Step\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v2\n with:\n ref: ${{ github.event.workflow_run.head_branch }}\n - run: git branch\n - run: env"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I commit case-sensitive only filename changes in Git?\nI have changed a few files name by de-capitalize the first letter, as in Name.jpg to name.jpg. Git does not recognize this changes and I had to delete the files and upload them again. Is there a way that Git can be case-sensitive when checking for changes in file names? I have not made any changes to the file itself."
},
{
"role": "assistant",
"content": "As long as you're just renaming a file, and not a folder, you can just use git mv:\ngit mv -f yOuRfIlEnAmE yourfilename\n\n(As of a change in Git 2.0.1, the -f flag in the incantation above is superfluous, but it was needed in older Git versions.)"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-cherry-pick - Apply the changes introduced by some existing commits --keep-redundant-commits"
},
{
"role": "assistant",
"content": "Deprecated synonym for --empty=keep ."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-apply - Apply a patch to files and/or to the index --include=<path-pattern>"
},
{
"role": "assistant",
"content": "Apply changes to files matching the given path pattern. This can\nbe useful when importing patchsets, where you want to include certain\nfiles or directories. When --exclude and --include patterns are used, they are examined in the\norder they appear on the command line, and the first match determines if a\npatch to each path is used. A patch to a path that does not match any\ninclude/exclude pattern is used by default if there is no include pattern\non the command line, and ignored if there is any include pattern."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git - the stupid content tracker git-sparse-checkout"
},
{
"role": "assistant",
"content": "Reduce your working tree to a subset of tracked files"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Git - What is \"Refspec\"\nI've been following this guide on configuring GitLab continuous integration with Jenkins.\nAs part of the process, it is necessary to set the refspec as follows: +refs/heads/*:refs/remotes/origin/* +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*\nWhy this is necessary is not explained in the post, so I began looking online for an explanation and looked at the official documentation as well as some related StackOverflow questions like this one.\nIn spite of this, I'm still confused:\nWhat exactly is refspec? And why is the above refspec necessary – what does it do?"
},
{
"role": "assistant",
"content": "A refspec tells git how to map references from a remote to the local repo.\nThe value you listed was +refs/heads/*:refs/remotes/origin/* +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*; so let's break that down.\nYou have two patterns with a space between them; this just means you're giving multiple rules. (The pro git book refers to this as two refspecs; which is probably technically more correct. However, you just about always have the ability to list multiple refspecs if you need to, so in day to day life it likely makes little difference.)\nThe first pattern, then, is +refs/heads/*:refs/remotes/origin/* which has three parts:\n\nThe + means to apply the rule without failure even if doing so would move a target ref in a non-fast-forward manner. I'll come back to that.\nThe part before the : (but after the + if there is one) is the \"source\" pattern. That's refs/heads/*, meaning this rule applies to any remote reference under refs/heads (meaning, branches).\nThe part after the : is the \"destination\" pattern. That's refs/remotes/origin/*.\n\nSo if the origin has a branch master, represented as refs/heads/master, this will create a remote branch reference origin/master represented as refs/remotes/origin/master. And so on for any branch name (*).\nSo back to that +... suppose the origin has\nA --- B <--(master)\n\nYou fetch and, applying that refspec you get\nA --- B <--(origin/master)\n\n(If you applied typical tracking rules and did a pull you also have master pointed at B.) \nA --- B <--(origin/master)(master)\n\nNow some things happen on the remote. Someone maybe did a reset that erased B, then committed C, then forced a push. So the remote says\nA --- C <--(master)\n\nWhen you fetch, you get\nA --- B\n \\\n C\n\nand git must decide whether to allow the move of origin/master from B to C. By default it wouldn't allow this because it's not a fast-forward (it would tell you it rejected the pull for that ref), but because the rule starts with + it will accept it. \nA --- B <--(master)\n \\\n C <--(origin/master)\n\n(A pull will in this case result in a merge commit.)\nThe second pattern is similar, but for merge-requests refs (which I assume is related to your server's implementation of PR's; I'm not familiar with it).\nMore about refspecs: https://git-scm.com/book/en/v2/Git-Internals-The-Refspec"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Pull git submodules after cloning project from GitHub\nI have a project that has specified submodules in it. Everything works well on the dev machine. I have commited .gitmodules file and pulled on the production. However it does not pulled submodules.\nIf I go into submodule directories and call git pull, nothing happens.\nWhat is the proper way to pull those submodules in the new project ?"
},
{
"role": "assistant",
"content": "From the root of the repo just run:\ngit submodule update --init"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How can I undo git reset --hard HEAD~1?\nIs it possible to undo the changes caused by the following command? If so, how?\ngit reset --hard HEAD~1"
},
{
"role": "assistant",
"content": "Pat Notz is correct. You can get the commit back so long as it's been within a few days. git only garbage collects after about a month or so unless you explicitly tell it to remove newer blobs.\n$ git init\nInitialized empty Git repository in .git/\n\n$ echo \"testing reset\" > file1\n$ git add file1\n$ git commit -m 'added file1'\nCreated initial commit 1a75c1d: added file1\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 file1\n\n$ echo \"added new file\" > file2\n$ git add file2\n$ git commit -m 'added file2'\nCreated commit f6e5064: added file2\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 file2\n\n$ git reset --hard HEAD^\nHEAD is now at 1a75c1d... added file1\n\n$ cat file2\ncat: file2: No such file or directory\n\n$ git reflog\n1a75c1d... HEAD@{0}: reset --hard HEAD^: updating HEAD\nf6e5064... HEAD@{1}: commit: added file2\n\n$ git reset --hard f6e5064\nHEAD is now at f6e5064... added file2\n\n$ cat file2\nadded new file\n\nYou can see in the example that the file2 was removed as a result of the hard reset, but was put back in place when I reset via the reflog."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Same steps for multiple named environments with GitLab CI\n\nIs there a way to configure multiple specifically-named environments (specifically, test, stage, and prod)?\nIn their documentation (https://docs.gitlab.com/ce/ci/environments.html) they talk about dynamically-created environments, but they are all commit based.\nMy build steps are the same for all of them, save for swapping out the slug:\ndeploy_to_test:\n environment:\n name: test\n url: ${CI_ENVIRONMENT_SLUG}.mydomain.com\n scripts:\n - deploy ${CI_ENVIRONMENT_SLUG}\n\ndeploy_to_stage:\n environment:\n name: stage\n url: ${CI_ENVIRONMENT_SLUG}.mydomain.com\n scripts:\n - deploy ${CI_ENVIRONMENT_SLUG}\n\n deploy_to_prod:\n environment:\n name: prod\n url: ${CI_ENVIRONMENT_SLUG}.mydomain.com\n scripts:\n - deploy ${CI_ENVIRONMENT_SLUG}\n\nIs there any way to compress this down into one set of instructions? Something like:\ndeploy:\n environment:\n url: ${CI_ENVIRONMENT_SLUG}.mydomain.com\n scripts:\n - deploy ${CI_ENVIRONMENT_SLUG}"
},
{
"role": "assistant",
"content": "Yes, you can use anchors. If I follow the documentation properly, you would rewrite it using a hidden key .XX and then apply it with <<: *X.\nFor example this to define the key:\n.job_template: &deploy_definition\n environment:\n url: ${CI_ENVIRONMENT_SLUG}.mydomain.com\n scripts:\n - deploy ${CI_ENVIRONMENT_SLUG}\n\nAnd then all blocks can be writen using <<: *job_template. I assume environment will merge the name with the predefined URL.\ndeploy_to_test:\n <<: *deploy_definition\n environment:\n name: test\n\ndeploy_to_stage:\n <<: *deploy_definition\n environment:\n name: stage\n\n deploy_to_prod:\n <<: *deploy_definition\n environment:\n name: prod\n\n\nFull docs section from the link above:\n\nYAML has a handy feature called 'anchors', which lets you easily duplicate content across your document. Anchors can be used to duplicate/inherit properties, and is a perfect example to be used with hidden keys to provide templates for your jobs.\nThe following example uses anchors and map merging. It will create two jobs, test1 and test2, that will inherit the parameters of .job_template, each having their own custom script defined:\n.job_template: &job_definition # Hidden key that defines an anchor named 'job_definition'\n image: ruby:2.1\n services:\n - postgres\n - redis\n\ntest1:\n <<: *job_definition # Merge the contents of the 'job_definition' alias\n script:\n - test1 project\n\ntest2:\n <<: *job_definition # Merge the contents of the 'job_definition' alias\n script:\n - test2 project\n\n& sets up the name of the anchor (job_definition), << means \"merge the given hash into the current one\", and * includes the named anchor (job_definition again). The expanded version looks like this:\n.job_template:\n image: ruby:2.1\n services:\n - postgres\n - redis\n\ntest1:\n image: ruby:2.1\n services:\n - postgres\n - redis\n script:\n - test1 project\n\ntest2:\n image: ruby:2.1\n services:\n - postgres\n - redis\n script:\n - test2 project"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "GItlab: has there any way we can select the variable values as drop down menu\n\nIn Gitlab ci We have declared our variables like below\n USER_NAME:\n value: \"\" \n description: \"Enter Username\"\n File_Name:\n description: \"Enter the file name\"\n\nIt only give a text box where We can enter the value.\nCan I make a drop down select box is there any option available to make it a select box.Then we can select the value from drop down."
},
{
"role": "assistant",
"content": "GitLab 15.7 (December 2022) has finally implemented this:\n\nSelect predefined CI/CD variables values from a dropdown list\nPreviously, you could pre-fill CI/CD variables in the “Run pipeline” page, with a specific value.\nUnfortunately, if you had multiple options for the variable’s value, you still had to manually input the option you wanted. This was an error-prone process because you could easily input an invalid value, or just mistype it.\nIn this release, we’ve added the ability to set a list of values which are surfaced in a drop-down list in the “Run pipeline” page.\nNow you can define the exact list of values that are valid for each CI/CD variable when running a pipeline manually, greatly simplifying your workflow when using manually-triggered pipelines.\n\nSee Documentation and Issue."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "fatal: bad default revision 'HEAD'\nI'm using GIT as my source control system. We have it installed on one of our Linux boxes. Tortoise GIT is my windows client.\nThis morning I checked in some changes, and tagged the code. I then did a push of my local repository to the remote repository.\nWhen I go to my repository on the unix box and type in git log I get:\nfatal: bad default revision 'HEAD'\n\nBut when I do a show log using my windows tortoiseGit client the history comes up nicely as per below...\n---\nSHA-1: f879573ba3d8e62089b8c673257c928779f71692\n\nInitial drop of code\n\n---\nmaster origin/master oms-phase4-v1.0.0\nSHA-1: 56176dbe45e6175b18c9f44533828806c63142ab\n\nOMS Phase 4 - Added OMS Cust. Order No. to EDI Purchase Order Header screens\n\nTag Info\n\nobject 56176dbe45e6175b18c9f44533828806c63142ab\ntype commit\ntag oms-phase4-v1.0.0\ntagger Richard Riviere <[email protected]> 1364338495 +1100\n\n---\nSHA-1: 0000000000000000000000000000000000000000\n\nWorking dir changes\n0 files changed\n\n---\n\nThe code has definitely been pushed to the remote repository. I've been able to check by cloning the repository into a different directory.\nDoes anyone know why I am receiving the fatal: bad default revision 'HEAD'?\np.s. It is a bare repository however I have created other bare repositories which have not had this problem."
},
{
"role": "assistant",
"content": "just do an initial commit and the error will go away:\ngit commit -m \"initial commit\""
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "How do I install imagemagick with homebrew?\nI'm trying to install Imagemagick on OSX Lion but something is not working as expected.\n-> brew install imagemagick\n\n/usr/local/git/bin/git\n==> Cloning https://github.com/adamv/ImageMagick.git\nCloning into /Users/klebershimabuku/Library/Caches/Homebrew/imagemagick--git...\nfatal: https://github.com/adamv/ImageMagick.git/info/refs not found: did you run git update-server-info on the server?\nError: Failure while executing: git clone --depth 1 https://github.com/adamv/ImageMagick.git /Users/kleber/Library/Caches/Homebrew/imagemagick--git\n\nbrew doctor says:\n-> brew doctor\nWe couldn't detect gcc 4.0.x. Some formulae require this compiler.\n\nSome \"config\" scripts were found in your path, but not in system or Homebrew folders.\n\n`./configure` scripts often look for *-config scripts to determine if software packagesare installed, and what additional flags to use when compiling and linking.\n\nHaving additional scripts in your path can confuse software installed via Homebrew if the config script overrides a system or Homebrew provided script of the same name.\n\n/Users/kleber/.rvm/gems/ruby-1.9.2-p180@global/bin\npassenger-config\n\nSetting DYLD_LIBARY_PATH can break dynamic linking.\nYou should probably unset it.\n\nAnd yes, I have XCode 4.1 installed and running.\n-> brew update\nFrom http://github.com/mxcl/homebrew\n* branch master -> FETCH_HEAD\nAlready up-to-date."
},
{
"role": "assistant",
"content": "You could try:\nbrew update && brew install imagemagick"
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Issues with pushing large files through Git\n\nCurrently when I try to push to a Git repo, I am getting the following error.\nremote: error: GH001: Large files detected.\nremote: error: Trace: 7bbfe5c1099cfe679aa3cd1eee13e10a\nremote: error: See http://git.io/iEPt8g for more information.\nremote: error: File e3384023be667de7529538b11c12ec68.201307290946.sql.gz is 125.37 MB; this exceeds GitHub's file size limit of 100 MB\n\nI have gone through and made sure that this file does not exist in the directory, and have done git add -u. We have tried to prune the branch but this doesn't work as it can't find the file to delete."
},
{
"role": "assistant",
"content": "It is possible that you are pushing several commits, one of them including a large file, and another more recent one removing that file.\n2020-2022:\nUse git filter-repo (python-based, to be installed first)\nAnd use some content-based filtering:\n\nIf you want to filter out all files bigger than a certain size, you can use --strip-blobs-bigger-than with some size (K, M, and G suffixes are recognized), e.g.:\ngit filter-repo --strip-blobs-bigger-than 10M\n\n\n\nOriginal answer, using obsolete tools like git filter-branch or BFG:\nIn any case, you can try, as explained in \"Fixing the “this exceeds GitHub’s file size limit of 100 MB” error\", a filter-branch (if you know the name/path of the large file that you can't see)\ngit filter-branch --index-filter 'git rm --cached --ignore-unmatch e3384023be667de7529538b11c12ec68.201307290946.sql.gz' <sha1>..HEAD\n\nOr, if you don't know but want to get rid of any large file (say > 90MB), you can use the BFG repo cleaner\nbfg --strip-blobs-bigger-than 90M my-repo.git\n\nThat will track for you that elusive large file in your repo history and remove it.\nNote that you will have to do a git push --force after that, because the history of the more recent commits will have been modified.\nIf others already cloned your repo before, a bit of communication is in order to warn them."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-config - Get and set repository or global options safe.bareRepository"
},
{
"role": "assistant",
"content": "Specifies which bare repositories Git will work with. The currently\nsupported values are: all : Git works with all bare repositories. This is the default. explicit : Git only works with bare repositories specified via\nthe top-level --git-dir command-line option, or the GIT_DIR environment variable (see git ). If you do not use bare repositories in your workflow, then it may be\nbeneficial to set safe.bareRepository to explicit in your global\nconfig. This will protect you from attacks that involve cloning a\nrepository that contains a bare repository and running a Git command\nwithin that directory. This config setting is only respected in protected configuration (see SCOPES ). This prevents untrusted repositories from tampering with\nthis value."
}
] |
[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "git-log - Show commit logs --no-decorate --decorate[=short|full|auto|no]"
},
{
"role": "assistant",
"content": "Print out the ref names of any commits that are shown. If short is\nspecified, the ref name prefixes refs/heads/ , refs/tags/ and refs/remotes/ will not be printed. If full is specified, the\nfull ref name (including prefix) will be printed. If auto is\nspecified, then if the output is going to a terminal, the ref names\nare shown as if short were given, otherwise no ref names are\nshown. The option --decorate is short-hand for --decorate=short .\nDefault to configuration value of log.decorate if configured,\notherwise, auto ."
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.