messages
listlengths
3
3
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-fsck - Verifies the connectivity and validity of the objects in the database gitmodulesParse" }, { "role": "assistant", "content": "(INFO) Could not parse .gitmodules blob." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "AWS ECS: Force redeployment on new latest image in ECR\n\nI know that there are already countless questions in this direction, but unfortunately I was not able to find the right answer yet. If a post already exists, please just share the link here.\nI have several gitlab CI / CD pipelines. The first pipeline uses Terraform to build the complete infrastructure for an ECS cluster based on Fargate. The second / third pipeline creates nightly builds of the frontend and the backend and pushes the Docker Image with the tag \"latest\" into the ECR of the (staging) AWS account.\nWhat I now want to achieve is that the corresponding ECS tasks are redeloyed so that the latest Docker images are used. I actually thought that there is a way to do this via CloudWatch Events or whatsoever, but I don't find a really good starting point here. A workaround would be to install the AWS CLI in the CI / CD pipeline and then do a service update with \"force new deployment\". But that doesn't seem very elegant to me. Is there any better way here?\nConditions:\n\nThe solution must be fully automated (either in AWS or in gitlab CI / CD)\nSwitching to AWS CodePipeline is out of discussion\nIdeally as close as possible to AWS standards. I would like to avoid extensive lambda functions that perform numerous actions due to their maintainability.\n\nThanks a lot!" }, { "role": "assistant", "content": "Ok, for everybody who is interested in an answer. I solved it that way:\nI execute the following AWS CLI command in the CICD pipeline\naws ecs update-service --cluster <<cluster-name>> --service <<service-name>> --force-new-deployment --region <<region>>\n\nNot the solution I was looking for but it works." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The unauthenticated git protocol on port 9418 is no longer supported\nI have been using github actions for quite sometime but today my deployments started failing. Below is the error from github action logs\nCommand: git\nArguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git\nDirectory: /home/runner/work/stackstream-fe/stackstream-fe\nOutput:\nfatal: remote error: \n The unauthenticated git protocol on port 9418 is no longer supported.\n\nUpon investigation, it appears that below section in my yml file is causing the issue.\n - name: Installing modules\n run: yarn install\n\nI have looked into this change log but can't seem to comprehend the issue.\nAdditional Details:\nServer: EC2 Instance\nGithub actions steps:\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n\n - id: vars\n run: |\n if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo \"::set-output name=environment::prod_stackstream\" ; echo \"::set-output name=api-url::api\" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo \"::set-output name=environment::staging_stackstream\" ; echo \"::set-output name=api-url::stagingapi\" ; else echo \"::set-output name=environment::dev_stackstream\" ; echo \"::set-output name=api-url::devapi\" ; fi\n\n - uses: pCYSl5EDgo/cat@master\n id: slack\n with:\n path: .github/workflows/slack.txt\n\n - name: Slack Start Notification\n uses: 8398a7/action-slack@v3\n env:\n SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}\n ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'\n COLOR: good\n STATUS: '`Started`'\n with:\n status: custom\n fields: workflow,job,commit,repo,ref,author,took\n custom_payload: |\n ${{ steps.slack.outputs.text }}\n\n - name: Installing modules\n env:\n REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'\n run: yarn install\n\n - name: Create Frontend Build\n env:\n REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'\n run: yarn build\n\n - name: Deploy to Frontend Server DEV\n if: ${{ contains(github.ref, 'dev') }}\n uses: easingthemes/[email protected]\n env:\n SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}\n ARGS: '-rltgoDzvO --delete'\n SOURCE: 'deploy/'\n REMOTE_HOST: ${{ secrets.DEV_HOST }}\n REMOTE_USER: plyfolio-dev\n TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'\n\npackage.json file\n {\n \"name\": \"stackstream-fe\",\n \"version\": \"1.0.0\",\n \"authors\": [\n \"[email protected]\"\n ],\n \"private\": true,\n \"dependencies\": {\n \"@fortawesome/fontawesome-svg-core\": \"^1.2.34\",\n \"@fortawesome/free-solid-svg-icons\": \"^5.15.2\",\n \"@fortawesome/react-fontawesome\": \"^0.1.14\",\n \"@fullcalendar/bootstrap\": \"^5.5.0\",\n \"@fullcalendar/core\": \"^5.5.0\",\n \"@fullcalendar/daygrid\": \"^5.5.0\",\n \"@fullcalendar/interaction\": \"^5.5.0\",\n \"@fullcalendar/react\": \"^5.5.0\",\n \"@lourenci/react-kanban\": \"^2.1.0\",\n \"@redux-saga/simple-saga-monitor\": \"^1.1.2\",\n \"@testing-library/jest-dom\": \"^5.11.9\",\n \"@testing-library/react\": \"^11.2.3\",\n \"@testing-library/user-event\": \"^12.6.0\",\n \"@toast-ui/react-chart\": \"^1.0.2\",\n \"@types/jest\": \"^26.0.14\",\n \"@types/node\": \"^14.10.3\",\n \"@types/react\": \"^16.9.49\",\n \"@types/react-dom\": \"^16.9.8\",\n \"@vtaits/react-color-picker\": \"^0.1.1\",\n \"apexcharts\": \"^3.23.1\",\n \"availity-reactstrap-validation\": \"^2.7.0\",\n \"axios\": \"^0.21.1\",\n \"axios-mock-adapter\": \"^1.19.0\",\n \"axios-progress-bar\": \"^1.2.0\",\n \"bootstrap\": \"^5.0.0-beta2\",\n \"chart.js\": \"^2.9.4\",\n \"chartist\": \"^0.11.4\",\n \"classnames\": \"^2.2.6\",\n \"components\": \"^0.1.0\",\n \"dotenv\": \"^8.2.0\",\n \"draft-js\": \"^0.11.7\",\n \"echarts\": \"^4.9.0\",\n \"echarts-for-react\": \"^2.0.16\",\n \"firebase\": \"^8.2.3\",\n \"google-maps-react\": \"^2.0.6\",\n \"history\": \"^4.10.1\",\n \"i\": \"^0.3.6\",\n \"i18next\": \"^19.8.4\",\n \"i18next-browser-languagedetector\": \"^6.0.1\",\n \"jsonwebtoken\": \"^8.5.1\",\n \"leaflet\": \"^1.7.1\",\n \"lodash\": \"^4.17.21\",\n \"lodash.clonedeep\": \"^4.5.0\",\n \"lodash.get\": \"^4.4.2\",\n \"metismenujs\": \"^1.2.1\",\n \"mkdirp\": \"^1.0.4\",\n \"moment\": \"2.29.1\",\n \"moment-timezone\": \"^0.5.32\",\n \"nouislider-react\": \"^3.3.9\",\n \"npm\": \"^7.6.3\",\n \"prop-types\": \"^15.7.2\",\n \"query-string\": \"^6.14.0\",\n \"react\": \"^16.13.1\",\n \"react-apexcharts\": \"^1.3.7\",\n \"react-auth-code-input\": \"^1.0.0\",\n \"react-avatar\": \"^3.10.0\",\n \"react-bootstrap\": \"^1.5.0\",\n \"react-bootstrap-editable\": \"^0.8.2\",\n \"react-bootstrap-sweetalert\": \"^5.2.0\",\n \"react-bootstrap-table-next\": \"^4.0.3\",\n \"react-bootstrap-table2-editor\": \"^1.4.0\",\n \"react-bootstrap-table2-paginator\": \"^2.1.2\",\n \"react-bootstrap-table2-toolkit\": \"^2.1.3\",\n \"react-chartist\": \"^0.14.3\",\n \"react-chartjs-2\": \"^2.11.1\",\n \"react-color\": \"^2.19.3\",\n \"react-confirm-alert\": \"^2.7.0\",\n \"react-content-loader\": \"^6.0.1\",\n \"react-countdown\": \"^2.3.1\",\n \"react-countup\": \"^4.3.3\",\n \"react-cropper\": \"^2.1.4\",\n \"react-data-table-component\": \"^6.11.8\",\n \"react-date-picker\": \"^8.0.6\",\n \"react-datepicker\": \"^3.4.1\",\n \"react-dom\": \"^16.13.1\",\n \"react-draft-wysiwyg\": \"^1.14.5\",\n \"react-drag-listview\": \"^0.1.8\",\n \"react-drawer\": \"^1.3.4\",\n \"react-dropzone\": \"^11.2.4\",\n \"react-dual-listbox\": \"^2.0.0\",\n \"react-facebook-login\": \"^4.1.1\",\n \"react-flatpickr\": \"^3.10.6\",\n \"react-google-login\": \"^5.2.2\",\n \"react-hook-form\": \"^7.15.2\",\n \"react-i18next\": \"^11.8.5\",\n \"react-icons\": \"^4.2.0\",\n \"react-image-lightbox\": \"^5.1.1\",\n \"react-input-mask\": \"^2.0.4\",\n \"react-jvectormap\": \"^0.0.16\",\n \"react-leaflet\": \"^3.0.5\",\n \"react-meta-tags\": \"^1.0.1\",\n \"react-modal-video\": \"^1.2.6\",\n \"react-notifications\": \"^1.7.2\",\n \"react-number-format\": \"^4.7.3\",\n \"react-perfect-scrollbar\": \"^1.5.8\",\n \"react-rangeslider\": \"^2.2.0\",\n \"react-rating\": \"^2.0.5\",\n \"react-rating-tooltip\": \"^1.1.6\",\n \"react-redux\": \"^7.2.1\",\n \"react-responsive-carousel\": \"^3.2.11\",\n \"react-router-dom\": \"^5.2.0\",\n \"react-script\": \"^2.0.5\",\n \"react-scripts\": \"3.4.3\",\n \"react-select\": \"^4.3.1\",\n \"react-sparklines\": \"^1.7.0\",\n \"react-star-ratings\": \"^2.3.0\",\n \"react-super-responsive-table\": \"^5.2.0\",\n \"react-switch\": \"^6.0.0\",\n \"react-table\": \"^7.6.3\",\n \"react-toastify\": \"^7.0.3\",\n \"react-toastr\": \"^3.0.0\",\n \"react-twitter-auth\": \"0.0.13\",\n \"reactstrap\": \"^8.8.1\",\n \"recharts\": \"^2.0.8\",\n \"redux\": \"^4.0.5\",\n \"redux-saga\": \"^1.1.3\",\n \"reselect\": \"^4.0.0\",\n \"sass\": \"^1.37.5\",\n \"simplebar-react\": \"^2.3.0\",\n \"styled\": \"^1.0.0\",\n \"styled-components\": \"^5.2.1\",\n \"toastr\": \"^2.1.4\",\n \"typescript\": \"^4.0.2\",\n \"universal-cookie\": \"^4.0.4\"\n },\n \"devDependencies\": {\n \"@typescript-eslint/eslint-plugin\": \"^2.27.0\",\n \"@typescript-eslint/parser\": \"^2.27.0\",\n \"@typescript-eslint/typescript-estree\": \"^4.15.2\",\n \"eslint-config-prettier\": \"^6.10.1\",\n \"eslint-plugin-prettier\": \"^3.1.2\",\n \"husky\": \"^4.2.5\",\n \"lint-staged\": \"^10.1.3\",\n \"prettier\": \"^1.19.1\",\n \"react-test-renderer\": \"^16.13.1\",\n \"redux-devtools-extension\": \"^2.13.8\",\n \"redux-mock-store\": \"^1.5.4\"\n },\n \"scripts\": {\n \"start\": \"react-scripts start\",\n \"build\": \"react-scripts build && mv build ./deploy/build\",\n \"build-local\": \"react-scripts build\",\n \"test\": \"react-scripts test\",\n \"eject\": \"react-scripts eject\"\n },\n \"eslintConfig\": {\n \"extends\": \"react-app\"\n },\n \"husky\": {\n \"hooks\": {\n \"pre-commit\": \"lint-staged\"\n }\n },\n \"lint-staged\": {\n \"*.{js,ts,tsx}\": [\n \"eslint --fix\"\n ]\n },\n \"browserslist\": {\n \"production\": [\n \">0.2%\",\n \"not dead\",\n \"not op_mini all\"\n ],\n \"development\": [\n \"last 1 chrome version\",\n \"last 1 firefox version\",\n \"last 1 safari version\"\n ]\n }\n}\n\npackage-lock.json" }, { "role": "assistant", "content": "First, this error message is indeed expected on Jan. 11th, 2022.\nSee \"Improving Git protocol security on GitHub\".\n\nJanuary 11, 2022 Final brownout.\nThis is the full brownout period where we’ll temporarily stop accepting the deprecated key and signature types, ciphers, and MACs, and the unencrypted Git protocol.\nThis will help clients discover any lingering use of older keys or old URLs.\n\nSecond, check your package.json dependencies for any git:// URL, as in this example, fixed in this PR.\nAs noted by Jörg W Mittag:\n\nThere was a 4-month warning.\nThe entire Internet has been moving away from unauthenticated, unencrypted protocols for a decade, it's not like this is a huge surprise.\nPersonally, I consider it less an \"issue\" and more \"detecting unmaintained dependencies\".\nPlus, this is still only the brownout period, so the protocol will only be disabled for a short period of time, allowing developers to discover the problem.\nThe permanent shutdown is not until March 15th.\n\n\nFor GitHub Actions:\nAs in actions/checkout issue 14, you can add as a first step:\n - name: Fix up git URLs\n run: echo -e '[url \"https://github.com/\"]\\n insteadOf = \"git://github.com/\"' >> ~/.gitconfig\n\nThat will change any git://github.com/ into https://github.com/.\nFor local projects\nFor all your repositories, you can set:\ngit config --global url.\"https://github.com/\".insteadOf git://github.com/\n\n\nYou can also use SSH, but GitHub Security reminds us that, as of March 15th, 2022, GitHub stopped accepting DSA keys. RSA keys uploaded after Nov 2, 2021 will work only with SHA-2 signatures.\nThe deprecated MACs, ciphers, and unencrypted Git protocol are permanently disabled.\nSo this (with the right key) would work:\ngit config --global url.\"[email protected]:\".insteadOf git://github.com/\n\nThat will change any git://github.com/ (unencrypted Git protocol) into [email protected]: (SSH URL)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Undo working copy modifications of one file in Git\nAfter the last commit, I modified a bunch of files in my working copy, but I want to undo the changes to one of those files, as in reset it to the same state as the most recent commit.\nHowever, I only want to undo the working copy changes of just that one file alone, nothing else with it.\nHow do I do that?" }, { "role": "assistant", "content": "You can use\ngit checkout -- file\n\nYou can do it without the -- (as suggested by nimrodm), but if the filename looks like a branch or tag (or other revision identifier), it may get confused, so using -- is best.\nYou can also check out a particular version of a file:\ngit checkout v1.2.3 -- file # tag v1.2.3\ngit checkout stable -- file # stable branch\ngit checkout origin/master -- file # upstream master\ngit checkout HEAD -- file # the version from the most recent commit\ngit checkout HEAD^ -- file # the version before the most recent commit\n\nMore details included based on comments\nFirst check the the commits of the file\ngit log -- <filename>\n\nThen you can run this\ngit checkout <sha-reference> -- filename\n\nwhere the sha-reference is a reference to the sha of a commit, in any form (branch, tag, parent, etc." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can you git pull only the current branch?\nIs there a config way to set this up without having to specify which branch?" }, { "role": "assistant", "content": "Git already only pulls the current branch. If you have branch set up as a tracking branch, you do not need to specify the remote branch. git branch --set-upstream-to=reponame/remotebranch localbranch will set up the tracking relationship. You then issue git pull [--rebase] and only that branch will be updated.\nOf course, all remote tracking branches and all refs for the remote will be updated, but only your local tracking branch will be modified.\nUseful Bash alias to cut down on typing of this common operation:\n# Add an alias to pulling latest git changes into your same branch\nalias pullhead='git pull origin $(git rev-parse --abbrev-ref HEAD)'\n\nPowershell function that does the same:\nFunction pullhead {\n $cur_head=\"$(git rev-parse --abbrev-ref HEAD)\"\n & git pull origin ${cur_head}\n}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git Pull Failed: Invocation failed Unexpected end of file from server\nI'm trying to execute a git pull using Android Studio's built-in button, but it fails with this message:\nGit Pull Failed\n Invocation failed Unexpected end of file from server\n java.lang.RuntimeException: Invocation failed Unexpected end of file from server\n at org.jetbrains.git4idea.http.GitAskPassXmlRpcClient.askUsername(GitAskPassXmlRpcClient.java:55)\n at org.jetbrains.git4idea.http.GitAskPassApp.main(GitAskPassApp.java:66)\n Caused by: java.net.SocketException: Unexpected end of file from server\n at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)\n at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)\n at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:848)\n at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)\n at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)\n at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)\n at org.apache.xmlrpc.DefaultXmlRpcTransport.sendXmlRpc(DefaultXmlRpcTransport.java:87)\n at org.apache.xmlrpc.XmlRpcClientWorker.execu... (show balloon)\n\nWhat are the reasons this could be failing?" }, { "role": "assistant", "content": "You can enable the option \"Use credential helper\" in Android Studio's Preferences menu.\nThe option is located at Preferences -> Version Control -> Git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "automated django receive hook on server: respond to collectstatic with \"yes\"\nI'm using a Github post-recieve hook to run a bash file that pulls both my repos.\n#!/bin/sh\ncd ~/public_html/repo_static\nenv -i /usr/bin/git pull origin master\ncd ~/django-code/repo_django\nenv -i /usr/bin/git pull origin master\n\nI also want to collectstatic on the django repo. How do I automate the \"yes\" response to that? \nI can't use Fabric because unfortunately the team chose to work with Python 2.4 for the time being. Is there a way to automate collectstatic without Fabric?" }, { "role": "assistant", "content": "python manage.py collectstatic --noinput" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc color" }, { "role": "assistant", "content": "Highlight changed words using only colors. Implies --color ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Docker - Gitlab container. SSH git login error\n\nI have a Docker container with a Gitlab application. When i execute a git clone/push/pull the command not work and output this message:\n\"fatal protocol error bad line length character: Welc\"\nThe server response is not the response expected by git (it is a response for a common ssh connection).\nThis occurs because there is an error during the connection, see:\n Mar 20 14:55:31 gitlab sshd[7934]: reverse mapping checking getaddrinfo for XXXX.XXXX.XXX.XX.static.host.gvt.net.br [XXXX.XXXX.XXX.XX] failed - POSSIBLE BREAK-IN ATTEMPT!\n Mar 20 14:55:32 gitlab sshd[7934]: Accepted publickey for git from XXXX.XXXX.XXX.XX port XXXX ssh2\n Mar 20 14:55:32 gitlab sshd[7934]: pam_loginuid(sshd:session): set_loginuid failed\n Mar 20 14:55:32 gitlab sshd[7934]: pam_unix(sshd:session): session opened for user git by (uid=0)\n Mar 20 14:55:32 gitlab sshd[7934]: pam_env(sshd:session): Unable to open env file: /etc/default/locale: No such file or directory\n Mar 20 14:55:32 gitlab sshd[7934]: error: PAM: pam_open_session(): Cannot make/remove an entry for the specified session\n\nInfo \n\nGitLab version: 6.6.5\nDocker version: 9.0\nHost: Ubuntu 13.10\nContainer: Ubuntu 13.10\n\nI think i need to enable something in my Docker container because outside a Docker container the gitlab works correctly.\nHow to fix this?\nThanks!" }, { "role": "assistant", "content": "I fix this following this article: \nhttp://www.linuxweblog.com/blogs/sandip/20090203/setloginuid-failed-opening-loginuid\nJust comment this line in file \"/etc/pam.d/sshd\":\nsession required pam_loginuid.so" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git commit stopped working - Error building trees\nI can not commit a change:\n$ git commit\nerror: invalid object 100644 13da9eeff5a9150cf2135aaed4d2e337f97b8114 for 'spec/routing/splits_routing_spec.rb'\nerror: Error building trees\n\nI tried so far:\n$ git fsck | grep 13da\nmissing blob 13da9eeff5a9150cf2135aaed4d2e337f97b8114\n\nand also:\n$ git prune\nerror: Could not read 1394dce6fd1ad15a70b2f2623509082007dc5b6c\nfatal: bad tree object 1394dce6fd1ad15a70b2f2623509082007dc5b6c\n\nand also:\n$ git fsck | grep 13da\nmissing blob 13da9eeff5a9150cf2135aaed4d2e337f97b8114\n\nbut nothing helped. Should I delete the file, commit and reintroduce back? I am willing to lose little bit of history if it brings git commit back." }, { "role": "assistant", "content": "This error means that you have a file with hash 13da9eeff5a9150cf2135aaed4d2e337f97b8114, and this hash is not present in .git/objects/../, or it's empty. When this error occurred, I only had this hash in the error, without the file path. Then I tried to do git gc --auto and git reset --hard. After one of these commands (these commands did not fix my problem), I got the path of the file that triggers the error. \nYou just need to generate the object hash:\ngit hash-object -w spec/routing/splits_routing_spec.rb\n\nFor more information see documentation. In the documentation, there is an additional way of repairing this error.\nP.S.\nThis was the only way that was helpful for me." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "The unauthenticated git protocol on port 9418 is no longer supported\n\nI have been using github actions for quite sometime but today my deployments started failing. Below is the error from github action logs\nCommand: git\nArguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git\nDirectory: /home/runner/work/stackstream-fe/stackstream-fe\nOutput:\nfatal: remote error: \n The unauthenticated git protocol on port 9418 is no longer supported.\n\nUpon investigation, it appears that below section in my yml file is causing the issue.\n - name: Installing modules\n run: yarn install\n\nI have looked into this change log but can't seem to comprehend the issue.\nAdditional Details:\nServer: EC2 Instance\nGithub actions steps:\n steps:\n - name: Checkout\n uses: actions/checkout@v2\n\n - id: vars\n run: |\n if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo \"::set-output name=environment::prod_stackstream\" ; echo \"::set-output name=api-url::api\" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo \"::set-output name=environment::staging_stackstream\" ; echo \"::set-output name=api-url::stagingapi\" ; else echo \"::set-output name=environment::dev_stackstream\" ; echo \"::set-output name=api-url::devapi\" ; fi\n\n - uses: pCYSl5EDgo/cat@master\n id: slack\n with:\n path: .github/workflows/slack.txt\n\n - name: Slack Start Notification\n uses: 8398a7/action-slack@v3\n env:\n SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}\n ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'\n COLOR: good\n STATUS: '`Started`'\n with:\n status: custom\n fields: workflow,job,commit,repo,ref,author,took\n custom_payload: |\n ${{ steps.slack.outputs.text }}\n\n - name: Installing modules\n env:\n REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'\n run: yarn install\n\n - name: Create Frontend Build\n env:\n REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'\n run: yarn build\n\n - name: Deploy to Frontend Server DEV\n if: ${{ contains(github.ref, 'dev') }}\n uses: easingthemes/[email protected]\n env:\n SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}\n ARGS: '-rltgoDzvO --delete'\n SOURCE: 'deploy/'\n REMOTE_HOST: ${{ secrets.DEV_HOST }}\n REMOTE_USER: plyfolio-dev\n TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'\n\npackage.json file\n {\n \"name\": \"stackstream-fe\",\n \"version\": \"1.0.0\",\n \"authors\": [\n \"[email protected]\"\n ],\n \"private\": true,\n \"dependencies\": {\n \"@fortawesome/fontawesome-svg-core\": \"^1.2.34\",\n \"@fortawesome/free-solid-svg-icons\": \"^5.15.2\",\n \"@fortawesome/react-fontawesome\": \"^0.1.14\",\n \"@fullcalendar/bootstrap\": \"^5.5.0\",\n \"@fullcalendar/core\": \"^5.5.0\",\n \"@fullcalendar/daygrid\": \"^5.5.0\",\n \"@fullcalendar/interaction\": \"^5.5.0\",\n \"@fullcalendar/react\": \"^5.5.0\",\n \"@lourenci/react-kanban\": \"^2.1.0\",\n \"@redux-saga/simple-saga-monitor\": \"^1.1.2\",\n \"@testing-library/jest-dom\": \"^5.11.9\",\n \"@testing-library/react\": \"^11.2.3\",\n \"@testing-library/user-event\": \"^12.6.0\",\n \"@toast-ui/react-chart\": \"^1.0.2\",\n \"@types/jest\": \"^26.0.14\",\n \"@types/node\": \"^14.10.3\",\n \"@types/react\": \"^16.9.49\",\n \"@types/react-dom\": \"^16.9.8\",\n \"@vtaits/react-color-picker\": \"^0.1.1\",\n \"apexcharts\": \"^3.23.1\",\n \"availity-reactstrap-validation\": \"^2.7.0\",\n \"axios\": \"^0.21.1\",\n \"axios-mock-adapter\": \"^1.19.0\",\n \"axios-progress-bar\": \"^1.2.0\",\n \"bootstrap\": \"^5.0.0-beta2\",\n \"chart.js\": \"^2.9.4\",\n \"chartist\": \"^0.11.4\",\n \"classnames\": \"^2.2.6\",\n \"components\": \"^0.1.0\",\n \"dotenv\": \"^8.2.0\",\n \"draft-js\": \"^0.11.7\",\n \"echarts\": \"^4.9.0\",\n \"echarts-for-react\": \"^2.0.16\",\n \"firebase\": \"^8.2.3\",\n \"google-maps-react\": \"^2.0.6\",\n \"history\": \"^4.10.1\",\n \"i\": \"^0.3.6\",\n \"i18next\": \"^19.8.4\",\n \"i18next-browser-languagedetector\": \"^6.0.1\",\n \"jsonwebtoken\": \"^8.5.1\",\n \"leaflet\": \"^1.7.1\",\n \"lodash\": \"^4.17.21\",\n \"lodash.clonedeep\": \"^4.5.0\",\n \"lodash.get\": \"^4.4.2\",\n \"metismenujs\": \"^1.2.1\",\n \"mkdirp\": \"^1.0.4\",\n \"moment\": \"2.29.1\",\n \"moment-timezone\": \"^0.5.32\",\n \"nouislider-react\": \"^3.3.9\",\n \"npm\": \"^7.6.3\",\n \"prop-types\": \"^15.7.2\",\n \"query-string\": \"^6.14.0\",\n \"react\": \"^16.13.1\",\n \"react-apexcharts\": \"^1.3.7\",\n \"react-auth-code-input\": \"^1.0.0\",\n \"react-avatar\": \"^3.10.0\",\n \"react-bootstrap\": \"^1.5.0\",\n \"react-bootstrap-editable\": \"^0.8.2\",\n \"react-bootstrap-sweetalert\": \"^5.2.0\",\n \"react-bootstrap-table-next\": \"^4.0.3\",\n \"react-bootstrap-table2-editor\": \"^1.4.0\",\n \"react-bootstrap-table2-paginator\": \"^2.1.2\",\n \"react-bootstrap-table2-toolkit\": \"^2.1.3\",\n \"react-chartist\": \"^0.14.3\",\n \"react-chartjs-2\": \"^2.11.1\",\n \"react-color\": \"^2.19.3\",\n \"react-confirm-alert\": \"^2.7.0\",\n \"react-content-loader\": \"^6.0.1\",\n \"react-countdown\": \"^2.3.1\",\n \"react-countup\": \"^4.3.3\",\n \"react-cropper\": \"^2.1.4\",\n \"react-data-table-component\": \"^6.11.8\",\n \"react-date-picker\": \"^8.0.6\",\n \"react-datepicker\": \"^3.4.1\",\n \"react-dom\": \"^16.13.1\",\n \"react-draft-wysiwyg\": \"^1.14.5\",\n \"react-drag-listview\": \"^0.1.8\",\n \"react-drawer\": \"^1.3.4\",\n \"react-dropzone\": \"^11.2.4\",\n \"react-dual-listbox\": \"^2.0.0\",\n \"react-facebook-login\": \"^4.1.1\",\n \"react-flatpickr\": \"^3.10.6\",\n \"react-google-login\": \"^5.2.2\",\n \"react-hook-form\": \"^7.15.2\",\n \"react-i18next\": \"^11.8.5\",\n \"react-icons\": \"^4.2.0\",\n \"react-image-lightbox\": \"^5.1.1\",\n \"react-input-mask\": \"^2.0.4\",\n \"react-jvectormap\": \"^0.0.16\",\n \"react-leaflet\": \"^3.0.5\",\n \"react-meta-tags\": \"^1.0.1\",\n \"react-modal-video\": \"^1.2.6\",\n \"react-notifications\": \"^1.7.2\",\n \"react-number-format\": \"^4.7.3\",\n \"react-perfect-scrollbar\": \"^1.5.8\",\n \"react-rangeslider\": \"^2.2.0\",\n \"react-rating\": \"^2.0.5\",\n \"react-rating-tooltip\": \"^1.1.6\",\n \"react-redux\": \"^7.2.1\",\n \"react-responsive-carousel\": \"^3.2.11\",\n \"react-router-dom\": \"^5.2.0\",\n \"react-script\": \"^2.0.5\",\n \"react-scripts\": \"3.4.3\",\n \"react-select\": \"^4.3.1\",\n \"react-sparklines\": \"^1.7.0\",\n \"react-star-ratings\": \"^2.3.0\",\n \"react-super-responsive-table\": \"^5.2.0\",\n \"react-switch\": \"^6.0.0\",\n \"react-table\": \"^7.6.3\",\n \"react-toastify\": \"^7.0.3\",\n \"react-toastr\": \"^3.0.0\",\n \"react-twitter-auth\": \"0.0.13\",\n \"reactstrap\": \"^8.8.1\",\n \"recharts\": \"^2.0.8\",\n \"redux\": \"^4.0.5\",\n \"redux-saga\": \"^1.1.3\",\n \"reselect\": \"^4.0.0\",\n \"sass\": \"^1.37.5\",\n \"simplebar-react\": \"^2.3.0\",\n \"styled\": \"^1.0.0\",\n \"styled-components\": \"^5.2.1\",\n \"toastr\": \"^2.1.4\",\n \"typescript\": \"^4.0.2\",\n \"universal-cookie\": \"^4.0.4\"\n },\n \"devDependencies\": {\n \"@typescript-eslint/eslint-plugin\": \"^2.27.0\",\n \"@typescript-eslint/parser\": \"^2.27.0\",\n \"@typescript-eslint/typescript-estree\": \"^4.15.2\",\n \"eslint-config-prettier\": \"^6.10.1\",\n \"eslint-plugin-prettier\": \"^3.1.2\",\n \"husky\": \"^4.2.5\",\n \"lint-staged\": \"^10.1.3\",\n \"prettier\": \"^1.19.1\",\n \"react-test-renderer\": \"^16.13.1\",\n \"redux-devtools-extension\": \"^2.13.8\",\n \"redux-mock-store\": \"^1.5.4\"\n },\n \"scripts\": {\n \"start\": \"react-scripts start\",\n \"build\": \"react-scripts build && mv build ./deploy/build\",\n \"build-local\": \"react-scripts build\",\n \"test\": \"react-scripts test\",\n \"eject\": \"react-scripts eject\"\n },\n \"eslintConfig\": {\n \"extends\": \"react-app\"\n },\n \"husky\": {\n \"hooks\": {\n \"pre-commit\": \"lint-staged\"\n }\n },\n \"lint-staged\": {\n \"*.{js,ts,tsx}\": [\n \"eslint --fix\"\n ]\n },\n \"browserslist\": {\n \"production\": [\n \">0.2%\",\n \"not dead\",\n \"not op_mini all\"\n ],\n \"development\": [\n \"last 1 chrome version\",\n \"last 1 firefox version\",\n \"last 1 safari version\"\n ]\n }\n}\n\npackage-lock.json" }, { "role": "assistant", "content": "First, this error message is indeed expected on Jan. 11th, 2022.\nSee \"Improving Git protocol security on GitHub\".\n\nJanuary 11, 2022 Final brownout.\nThis is the full brownout period where we’ll temporarily stop accepting the deprecated key and signature types, ciphers, and MACs, and the unencrypted Git protocol.\nThis will help clients discover any lingering use of older keys or old URLs.\n\nSecond, check your package.json dependencies for any git:// URL, as in this example, fixed in this PR.\nAs noted by Jörg W Mittag:\n\nThere was a 4-month warning.\nThe entire Internet has been moving away from unauthenticated, unencrypted protocols for a decade, it's not like this is a huge surprise.\nPersonally, I consider it less an \"issue\" and more \"detecting unmaintained dependencies\".\nPlus, this is still only the brownout period, so the protocol will only be disabled for a short period of time, allowing developers to discover the problem.\nThe permanent shutdown is not until March 15th.\n\n\nFor GitHub Actions:\nAs in actions/checkout issue 14, you can add as a first step:\n - name: Fix up git URLs\n run: echo -e '[url \"https://github.com/\"]\\n insteadOf = \"git://github.com/\"' >> ~/.gitconfig\n\nThat will change any git://github.com/ into https://github.com/.\nFor local projects\nFor all your repositories, you can set:\ngit config --global url.\"https://github.com/\".insteadOf git://github.com/\n\n\nYou can also use SSH, but GitHub Security reminds us that, as of March 15th, 2022, GitHub stopped accepting DSA keys. RSA keys uploaded after Nov 2, 2021 will work only with SHA-2 signatures.\nThe deprecated MACs, ciphers, and unencrypted Git protocol are permanently disabled.\nSo this (with the right key) would work:\ngit config --global url.\"[email protected]:\".insteadOf git://github.com/\n\nThat will change any git://github.com/ (unencrypted Git protocol) into [email protected]: (SSH URL)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Host static website with GitLab pages\n\nI need to host a static website with gitlab pages. My repo is a private repository (or project) and the .gitlab-ci.yml that I tried to use looks like this:\nimage: gpecchio:BeCall\npages:\n stage: deploy\n script:\n - echo 'Nothing to do...'\n artifacts:\n paths:\n - private\n only:\n - master\n\nI believe that the image is wrong but I have no idea about what to change it to. I did some research but there aren't that many tutorials online for GitLab pages. How could I change this file to make it work?\nOther info that might be useful: \nGitLab username: gpecchio \nGitLab project name: BeCall \nGitLab project url: https://gitlab.com/gpecchio/BeCall" }, { "role": "assistant", "content": "Is your website created in html or are you using a static generator to create your website and then using gitlab pages to host it?\nIn the .gitlab-ci.yml file, the artifacts need to be public (even if your repository is private) for hosting your website using gitlab pages.\nHere are some examples of what your .gitlab-ci.yml file needs to look like for hosting your site with gitlab pages.\nHTML\npages:\n stage: deploy\n script:\n - mkdir .public\n - cp -r * .public\n - mv .public public\n artifacts:\n paths:\n - public\n only:\n - master\n\nJekyll\nimage: ruby:2.3\n\npages:\n stage: deploy\n script:\n - gem install jekyll\n - jekyll build -d public/\n artifacts:\n paths:\n - public\n only:\n - master\n\nHexo\nimage: node:4.2.2\n\npages:\n cache:\n paths:\n - node_modules/\n\n script:\n - npm install hexo-cli -g\n - npm install\n - hexo deploy\n artifacts:\n paths:\n - public\n only:\n - master\n\nYou should check out https://gitlab.com/pages/ which has examples of static sites created using all the different static site generator and hosted using gitlab pages.\nYou can also find some Jekyll themes hosted on gitlab pages at https://gitlab.com/groups/jekyll-themes\nFinally, the link to your gitlab project url: https://gitlab.com/gpecchio/BeCall is private." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "[email protected]: Permission denied (publickey)\nI created a new remote repository and tried to use git push -u origin master command to push my local files into the new repository the first time after I add it and commit it. However, it pops up this [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.. How can I fix this fatal error?\nI've tried this\nHow to solve Permission denied (publickey) error when using Git?\nIt seems that the question in this link happens in the first time using git. I've used my git for a while, do I still need to follow this solution? Can anyone gives me a more specific solution? \nThis the fatal error that I got\nC:\\Users\\ASUS\\Desktop\\React-Practice App\\my-app>git status\nOn branch master\nnothing to commit, working tree clean\n\nC:\\Users\\ASUS\\Desktop\\React-Practice App\\my-app>git push -u origin master\n[email protected]: Permission denied (publickey).\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists." }, { "role": "assistant", "content": "You’re accessing GitHub through SSH. First generate an SSH key pair; then add the public key to GitHub.\nGenerate key pair, github prefers the \"Ed25519 algorithm\"\nssh-keygen -t ed25519 -C \"[email protected]\"\n\nIt still allows using rsa for systems that don't support Ed25519\nssh-keygen -t rsa -b 4096 -C “[email protected]”\n\nSee more at https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent and https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Cannot clone git from Azure DevOps using PAT\nI cannot clone a simple repository from Azure DevOps.\nOS: Ubuntu 18.10\nI do this: \n\nGot to Azure DevOps\nClick on the top right corner on my user name\nGo to the security tab \nCreate a PAT with all the scope (to be sure there is no scope\nproblem)\nCopy the PAT to the clipboard\nPaste the PAT somewhere else to confirm the PAT has been copied correctly (I know... not safe but that is out of the scope of this question)\nGo to my console \nIssue: git clone https://myorganization.visualstudio.com/myproject/_git/myrepo/ \nI enter the user name and the password (the PAT)\n\nI keep getting this message from Git:\nfatal: Authentication failed for 'https://myorganization.visualstudio.com/myproject/_git/myrepo/'\nI was reading the solutions of other people but none worked for me.\nI also tried this:\n\nPass the token in the form https://usename:[email protected]/myproject/_git/myrepo/ I am really surprised people say this worked... for my git complains\nbecause believes the : means the port. \nTried to\nactivate/deactivate credential manager of git * Tried on Windows and\nUbuntu. \nTried to activate and deactivate the simple credentials. \nTried with the simple credentials, i.e. username + password. \nTried to put my user name in https://username@....\nTried to use SSH\nTried to use the http.extraHeader in the git command with the header being Authorization: Basic Base64Encoded(uname:PAT)\nTried to use the http.extraHeader in the git command with the header being Authorization: Bearer PAT \nTried to use the VSCode client. It generates the PAT by itself but still cannot authenticate and clone.\nTried to use the Rider VSTS client. It generates the PAT by itself but still cannot authenticate and clone.\nTried to use the git credentials manager for Linux. It promps the Code and when we authenticate in the browser, it generates a PAT successfully. Still, after that cannot authenticate.\n\nAny clue why this is not working?" }, { "role": "assistant", "content": "I have had success using PAT like this;\n\nCopy clone URL for your repository e.g.\ngit clone https://<domain>.visualstudio.com/<domain>/_git/<repository>\nAfter you have copied your PAT use as:\ngit clone https://<PAT>@<domain>.visualstudio.com/<domain>/_git/<repository>\n\nNo Username nor password should be required as the PAT should suffice." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Find a Pull Request on GitHub where a commit was originally created\nPull Requests are great for understanding the larger thinking around a change or set of changes made to a repo. Reading pull requests are a great way to quickly \"grok\" a project as, instead of small atomic changes to the source, you get larger groupings of logical changes. Analogous to organizing the lines in your code into related \"stanzas\" to make it easier to read.\nI find myself looking at a file or a commit, and I wonder if there is a way to backtrack the commit to the Pull Request that originally created it. That Pull Request would have been merged eventually, but not necessary with a merge-commit." }, { "role": "assistant", "content": "You can just go to GitHub and enter the SHA into the search bar, make sure you select the \"Issues\" link on the left.\nUPDATED 13 July 2017\nVia the GitHub UI there is a now a really easy way to do this. If you are looking at a commit in the list of commits in a branch in the UI, click on the link to the commit itself. If there is a PR for that commit and it wasn't added directly to the branch, a link to the PR listing the PR number and the branch it went into will be directly under the commit message at the top of the page.\n\n\n\nIf you have the commit SHA and nothing else and don't want to go digging around for it, just add /commit/[commit SHA] to the repo url, and you will see the commit page, with the PR link if it exists.\nFor example, if the SHA is 52797a7a3b087231e4e391e11ea861569205aaf4 and the repo is https://github.com/glimmerjs/glimmer-vm , then go to https://github.com/glimmerjs/glimmer-vm/commit/52797a7a3b087231e4e391e11ea861569205aaf4" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Accidentally reverted to master, lost uncommitted changes\nWhile working on Master branch, I forgot to create new branch. Made changes to files then inadvertently reverted to the master, loosing all updates.\nI didn't commit the updated files.\nHow can I retrieve them?" }, { "role": "assistant", "content": "If you had not commited, staged, or stashed the changes you made, there is no way you can recover those changes.\nEDIT: Recovering lost changes. Adding this on Mark Longair's suggestion (in the comment). This also includes a couple of SO links from his answer below(*), that I found quite informative.\n\nIf you have ever committed some change and have lost that commit (like committing in a detached state), you can find that commit using reflog. See this SO question*.\nIf you have lost your last staged changes, you can also recover that. See this SO question*. (I have never used or tried it myself).\nIf you have stashed a change, you can also recover that using pop or apply. (I am not sure if the popped/dropped stashes are also recoverable that were not committed). You may find this Recover dropped stash in git useful.\n\nIf there are any other methods that anyone can suggest, I'd edit this answer further to add them." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: Merge to master while automatically choosing to overwrite master files with branch\nI am using Git to track my documentation latex source. I want to keep the master branch full of documents that are suitable for end user release, so when someone needs something, i can just switch to the master branch, compile and hand out the document. \nI make new branches when a manual needs a major update. But, when the manual is approved, it needs to get merged back into the master. When merging from branch into master, I would like to pass some command to Git to say, \"forget the merging, just use the the file from branch to overwrite the file in master.\" Is there a way to do this? Specifically, I want to avoid opening up a merge tool every time. Thanks in advance." }, { "role": "assistant", "content": "To disregard master, when you have branch checked out then:\ngit merge master --strategy=ours\n\nhttp://schacon.github.com/git/git-merge.html\nAs 'Computer Linguist' Lilith River\ncommented, this will \"ignore everything from 'master', even if it has changes to new, independent files\". So if you are not the OP and want a more safe merge that does not as the OP says \"forget the merging\", then use this excellent safe command from Lilith River, and upvote his comment up so he gets credit.\ngit merge -s recursive -X theirs <branch>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options http.sslCipherList" }, { "role": "assistant", "content": "A list of SSL ciphers to use when negotiating an SSL connection.\nThe available ciphers depend on whether libcurl was built against\nNSS or OpenSSL and the particular configuration of the crypto\nlibrary in use. Internally this sets the CURLOPT_SSL_CIPHER_LIST option; see the libcurl documentation for more details on the format\nof this list. Can be overridden by the GIT_SSL_CIPHER_LIST environment variable.\nTo force git to use libcurl’s default cipher list and ignore any\nexplicit http.sslCipherList option, set GIT_SSL_CIPHER_LIST to the\nempty string." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Should I add the google-services.json (from Firebase) to my repository?\nI just signed up with Firebase and I created a new project. Firebase asked me for my app domain and a SHA1 debug key. I input these details and it generated a google-services.json file for me to add in the root of my app module.\nMy question is, should this .json file be added to a public (open source) repo. Is it something that should be secret, like an API key?" }, { "role": "assistant", "content": "A google-services.json file is, from the Firebase doc:\n\nFirebase manages all of your API settings and credentials through a single configuration file.\nThe file is named google-services.json on Android and GoogleService-Info.plist on iOS.\n\nIt seems to make sense to add it to a .gitignore and not include it in a public repo.\nThis was discussed in issue 26, with more details on what google-services.json contains.\nA project like googlesamples/google-services does have it in its .gitignore for instance.\nAlthough, as commented by stepheaw, this thread does mention\n\nFor a library or open-source sample we do not include the JSON file because the intention is that users insert their own to point the code to their own backend.\nThat's why you won't see JSON files in most of our firebase repos on GitHub.\n\nIf the \"database URL, Android API key, and storage bucket\" are not secret for you, then you could consider adding the file to your repo.\nAs mentioned in \"Is google-services.json safe from hackers?\", this isn't that simple though.\nbaueric asks in the comments:\n\nIn that post he says:\n\nThe JSON file does not contain any super-sensitive information (like a server API key)\n\nBut the google-services.json does have entry called api_key.\nIs that a different api key than a \"server api key\"?\n\nWillie Chalmers III points to \"Is google-services.json safe from hackers?\", and adds:\n\nYes, that API key isn't a server API key which should never be public, so it's fine if your google-services.json is visible by others.\nIn any case, you should still restrict how your client API key can be used in the Google Cloud console.\n\n\nAs noted by Puzz in the comments, see also \"Is it safe to expose Firebase apiKey to the public?\"\nIn that answer, Frank Van Puffelen mentions:\nUpdate (May 2021): Thanks to the new feature called Firebase App Check, it is now actually possible to limit access to the backend services in your Firebase project to only those coming from iOS, Android and Web apps that are registered in that specific project." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to add files/folders to .gitignore in IntelliJ IDEA?\nI try to switch from Eclipse to IntelliJ IDEA. I have a project that uses Git and I want to quickly add files to .gitignore file. In Eclipse I can right click on a file/directory and choose 'Add to .gitignore'.\nIs there anything like this in IntelliJ IDEA or I have to edit the file manually?" }, { "role": "assistant", "content": "IntelliJ has no option to click on a file and choose \"Add to .gitignore\" like Eclipse has. \nThe quickest way to add a file or folder to .gitignore without typos is:\n\nRight-click on the file in the project browser and choose \"Copy Path\" (or use the keyboard shortcut that is displayed there).\nOpen the .gitignore file in your project, and paste.\nAdjust the pasted line so that it is relative to the location of the .gitignore file.\n\nAdditional info: There is a .ignore plugin available for IntelliJ which adds a \"Add to .gitignore\" item to the popup menu when you right-click a file. It works like a charm." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order %aD" }, { "role": "assistant", "content": "author date, RFC2822 style" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "\"fatal: HttpRequestException encountered.\" Error with GitHub/Bitbucket Repositories due to dropping TLS-1.0 support\nProblem\nI recently encountered the following message when I pushed to a GitHub repo:\n\"fatal: HttpRequestException encountered. \"\nfollowed by being prompted for my username and password again. \nFrom previous searches, Visual Studio and various others have the same root problem. For those lazier than I am, a summary of the various solutions for different applications/OS are here with relevant discussions. Hopefully people find this helpful.\nReason\nCan't really call updating sercurity a problem, so here's the reason. The issue is GitHub has removed TLS-1.0 support which is causing the problem with clients including Microsoft Visual Studio's built in git client, versions of Git below 1.14 as well as GUI clients includint tortoiseGit, etc. The full release notes can be found here: \nhttps://githubengineering.com/crypto-removal-notice/\nBitbucket will drop TLSv1.0 and TLSv1.1 starting 1 Dec 2018. I expect similar problems as before. \nSolution\nEdit: moved my self-answer to an answer box. See below." }, { "role": "assistant", "content": "Git hub has removed TLS-1.0 from it's authentication services. https://githubengineering.com/crypto-removal-notice/\nSolutions\nWindows Clients\nUse Version 2.14.3 (or newer) of Git for Windows and newer include an up-to-date Git Credential Manager for Windows: https://gitforwindows.org/\nYou can also explicitly update your Git Windows Credential Manager to the latest version, 1.14.0, to get TLS-1.2 support: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.14.0\nVisual Studio Clients\nIt is suggested to update your client to VS 2017 or, if you cannot upgrade, there are two machine-wide registry keys you can set that affect all .NET-based applications on the client machine that you can change... https://developercommunity.visualstudio.com/content/problem/201457/unable-to-connect-to-github-due-to-tls-12-only-cha.html\nJDK\nTLS-1.2 is default in JDK8 and available in JDK7.\nhttps://blogs.oracle.com/java-platform-group/diagnosing-tls,-ssl,-and-https\nRed Hat native Git clients\nRH 5 does not support TLS-1.2 and GitHubEngineering suggest updating to newer versions of the OS. RH 6.8 and 7.2 will support TLS-1.2. https://www.linuxquestions.org/questions/blog/mensawater-183304/rhel5-wont-support-tlsv1-1-or-higher-36951/" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-gc - Cleanup unnecessary files and optimize the local repository" }, { "role": "assistant", "content": "NOTES git gc tries very hard not to delete objects that are referenced\nanywhere in your repository. In particular, it will keep not only\nobjects referenced by your current set of branches and tags, but also\nobjects referenced by the index, remote-tracking branches, reflogs\n(which may reference commits in branches that were later amended or\nrewound), and anything else in the refs/* namespace. Note that a note\n(of the kind created by git notes ) attached to an object does not\ncontribute in keeping the object alive. If you are expecting some\nobjects to be deleted and they aren’t, check all of those locations\nand decide whether it makes sense in your case to remove those\nreferences. On the other hand, when git gc runs concurrently with another process,\nthere is a risk of it deleting an object that the other process is using\nbut hasn’t created a reference to. This may just cause the other process\nto fail or may corrupt the repository if the other process later adds a\nreference to the deleted object. Git has two features that significantly\nmitigate this problem: Any object with modification time newer than the --prune date is kept,\nalong with everything reachable from it. Most operations that add an object to the database update the\nmodification time of the object if it is already present so that #1\napplies. However, these features fall short of a complete solution, so users who\nrun commands concurrently have to live with some risk of corruption (which\nseems to be low in practice)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How does gitlab decide which runner to use for a job\n\nIf there are more than one available runner for a project, how does gitlab ci decide which runner to use?\nI have an omnibus gitlab 8.6.6-ee installation, with 2 runners configured. The runners are identical (docker images, config, etc) except that they are running on different computers.\nIf they are both idle and a job comes in that either of them could run, which one will run?" }, { "role": "assistant", "content": "To add to Rubinum's answer the 'first' runner would be whichever runner that checks in first that meets all criteria. For example, labels could limit which runners certain jobs run on.\nRunners query the gitlab server every X seconds to check if there are builds. if there's a build queued and multiple meet criteria, the first to ask will win\nUpdate to answer comments:\nRunners communicate through the CI API http://docs.gitlab.com/ce/ci/api/builds.html to get build status. This will eventually imply that it will become a more or less random choosing of the runner based on when it finished the last job and the xamount of msit is waiting to check. \nTo completely answer the question:\nCredit goes to BM5k after digging through the code and finding that x = 3 seconds based on this and this. Also found that:\n\nwhich machine a docker+machine runner will use once that runner has been selected) reveals that the machine selection is more or less (effectively) random as well" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-ls-tree - List the contents of a tree object objectmode" }, { "role": "assistant", "content": "The mode of the object." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "NPM install resulting in 401 Unauthorized for private repo\n\nI have the following line in my dependencies in package.json:\n\"log\": \"https://git.mydomain.com/myproject/myrepo/repository/archive.tar.gz?ref=0.1.0\",\n\nI get the following:\nkm@Karls-MBP ~/dev/vertica (km/ref) $ npm install\nnpm ERR! code E401\nnpm ERR! 404 401 Unauthorized: log@https://git.mydomain.com/myproject/myrepo/repository/archive.tar.gz?ref=0.5.0\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /Users/km/.npm/_logs/2018-02-16T08_49_38_669Y-debug.log\n\nI don't know if the issue is GitLab (where the repo exists) or NPM.\n\nNode v8.9.4\nNPM v5.6.0" }, { "role": "assistant", "content": "Remove .npmrc from the Home Directory, it should be able to work. I did the same and it works for me." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git add adding ignored files\nI'm trying to remove a previously tracked directory from git, which works, but it's being added back with each subsequent git add ., git add -A, etc. Here's what I've done:\nAdd to .gitignore in root of project:\nnode_modules\n\nRun the following:\ngit rm -r --cached node_modules\ngit commit -a -m \"removed node_modules\"\ngit push origin master\n\nSo far so good, this removes the directory from the remote repository. The problem is when I later run git status it tells me the node_modules directory is untracked and keeps adding it back on future commits.\nWhat am I missing and/or how do I find the root of my problem?\nFrom here:\n\nThe git add command will not add ignored files by default.\n ...\n The git add command can be used to add ignored files with the -f (force) option.\n\nAdditional information from comments:\nI am tracking .gitignore file.\ngit check-ignore node_modules/ returns node_modules/ as expected.\nNo use of submodules.\nUpdate:\nI've created a sample that appears to replicate the issue following the steps above:\nhttps://github.com/awhitehouse104/SampleRepo\nResolution:\nTo summarize the answer and comments from below, the issue was in the encoding of my .gitignore file. I had used echo 'node_modules' > .gitignore to create the file on windows 8 and it came out as UTF-16 with BOM (according to answer below). After a few google searches, it seems this is the default encoding with powershell and I can confirm that saving as UTF-8 seems to have resolved the issue.\ntldr; Probably don't use this method of creating .gitignore files or be prepared to change the encoding\necho 'node_modules' > .gitignore" }, { "role": "assistant", "content": "You probably have a negative rule (include-again rule, the one that starts with an !) in your .gitignore file somewhere after the node_modules line.\ngit check-ignore has a bug/ambiguity in the docs. You expect that if git check-ignore node_modules/ prints node_modules/, then node_modules/ is ignored. But actually it prints a pathname if that pathname matches any ignore pattern - positive or negative. The only way to be sure is to use the -v (--verbose) option, which will make git check-ignore print the matching pattern.\nMoreover, if git check-ignore -v says a directory is ignored, it doesn't necessarily mean that all files in that directory are ignored. Example repo:\n/\n .git/\n .gitignore\n node_modules/\n bar\n foo\n\n$ cat .gitignore \n/node_modules/*\n!/node_modules/foo\n\n$ git check-ignore -v node_modules/\n.gitignore:1:/node_modules/* node_modules/\n ^ positive pattern => ignored\n\n$ git check-ignore -v node_modules/foo\n.gitignore:2:!/node_modules/foo node_modules/foo\n ^ negative pattern => not ignored\n\n$ git add -A\n\n$ git status\n# On branch master\n# Changes to be committed:\n# (use \"git reset HEAD <file>...\" to unstage)\n#\n# new file: node_modules/foo\n#\n\nSo if git check-ignore -v node_modules/ says node_modules/ is ignored, do git add -A node_modules/ and then run git check-ignore -v --no-index against individual files that got added, to discover why they were added.\n\nUpdate: I didn't expect that: your .gitignore file is in \"UTF-16 with BOM (byte order mark)\" encoding:\n$ cat .gitignore | hexdump -vC\n00000000 ff fe 6e 00 6f 00 64 00 65 00 5f 00 6d 00 6f 00 |..n.o.d.e._.m.o.|\n00000010 64 00 75 00 6c 00 65 00 73 00 0d 00 0a 00 |d.u.l.e.s.....|\n\nThat's why git probably can't handle it. Save the file in UTF-8 without BOM, that should fix the problem. But I also suggest filing a bug report against git check-ignore - in this corner case its output is clearly not consistent with what git actually ignores." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-instaweb - Instantly browse your working repository in gitweb start --start" }, { "role": "assistant", "content": "Start the httpd instance and exit. Regenerate configuration files\nas necessary for spawning a new instance." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order %GK" }, { "role": "assistant", "content": "show the key used to sign a signed commit" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Managing hotfixes when develop branch is very different from master?\nI'm using the \"Git Flow\" branching model, with a master branch and a develop branch. I'm working on a major new release, so my develop branch is wildly different from my master branch. This creates a problem anytime I need to make a hotfix on the master branch and merge it back into develop. There are almost always conflicts, and it's becoming a real pain. \nWhat is the best way to manage this? It would be easier for me to make the small hotfix changes on develop manually and then merge everything into master when I'm ready without merging master back into develop. Is this possible?" }, { "role": "assistant", "content": "The simplest way to get some commits from one branch to another is cherry-picking. \nAssuming that your fix in master has the commit hash HASH and you want to take that hotfix into your devel branch, do a git checkout devel followed by a git cherry-pick HASH. That's it.\nIf you want to take all changes from master into devel, you can achieve that with\ngit checkout devel\ngit rebase master\n\n\nIf you have the opposite scenario (you make a hotfix during development in a devel branch and want to take that fix into master before devel gets fully merged into master), the workflow is quite similar. Assuming that the hotfix has the hash HOTFIX_HASH, do this:\ngit checkout master\ngit cherry-pick HOTFIX_HASH\n\nNow, the commit is present in master and devel. To get around this, type\ngit checkout devel\ngit rebase master\n\nand the commit will disappear from devel since it's already present in master." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I rename a local Git branch?\nHow can I rename a local branch which has not yet been pushed to a remote repository?\nRelated:\n\nRename master branch for both local and remote Git repositories\nHow do I rename both a Git local and remote branch name?" }, { "role": "assistant", "content": "To rename the current branch:\ngit branch -m <newname>\n\nTo rename a branch while pointed to any branch:\ngit branch -m <oldname> <newname>\n\n-m is short for --move.\n\nTo push the local branch and reset the upstream branch:\ngit push origin -u <newname>\n\nTo delete the remote branch:\ngit push origin --delete <oldname>\n\n\nTo create a git rename alias:\ngit config --global alias.rename 'branch -m'\n\n\nOn Windows or another case-insensitive filesystem, use -M if there are only capitalization changes in the name. Otherwise, Git will throw a \"branch already exists\" error.\ngit branch -M <newname>" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-shortlog - Summarize git log output -c --committer" }, { "role": "assistant", "content": "This is an alias for --group=committer ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git" }, { "role": "assistant", "content": "REBASE VS. PULL/MERGE Prefer to use git svn rebase or git rebase , rather than git pull or git merge to synchronize unintegrated commits with a git svn branch. Doing so will keep the history of unintegrated commits linear with\nrespect to the upstream SVN repository and allow the use of the preferred git svn dcommit subcommand to push unintegrated commits back into SVN. Originally, git svn recommended that developers pulled or merged from\nthe git svn branch. This was because the author favored git svn set-tree B to commit a single head rather than the git svn set-tree A..B notation to commit multiple commits. Use of git pull or git merge with git svn set-tree A..B will cause non-linear\nhistory to be flattened when committing into SVN and this can lead to merge\ncommits unexpectedly reversing previous commits in SVN." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker" }, { "role": "assistant", "content": "Discussion More detail on the following is available from the Git concepts chapter of the\nuser-manual and gitcore-tutorial . A Git project normally consists of a working directory with a \".git\"\nsubdirectory at the top level. The .git directory contains, among other\nthings, a compressed object database representing the complete history\nof the project, an \"index\" file which links that history to the current\ncontents of the working tree, and named pointers into that history such\nas tags and branch heads. The object database contains objects of three main types: blobs, which\nhold file data; trees, which point to blobs and other trees to build up\ndirectory hierarchies; and commits, which each reference a single tree\nand some number of parent commits. The commit, equivalent to what other systems call a \"changeset\" or\n\"version\", represents a step in the project’s history, and each parent\nrepresents an immediately preceding step. Commits with more than one\nparent represent merges of independent lines of development. All objects are named by the SHA-1 hash of their contents, normally\nwritten as a string of 40 hex digits. Such names are globally unique.\nThe entire history leading up to a commit can be vouched for by signing\njust that commit. A fourth object type, the tag, is provided for this\npurpose. When first created, objects are stored in individual files, but for\nefficiency may later be compressed together into \"pack files\". Named pointers called refs mark interesting points in history. A ref\nmay contain the SHA-1 name of an object or the name of another ref (the\nlatter is called a \"symbolic ref\").\nRefs with names beginning refs/head/ contain the SHA-1 name of the most\nrecent commit (or \"head\") of a branch under development. SHA-1 names of\ntags of interest are stored under refs/tags/ . A symbolic ref named HEAD contains the name of the currently checked-out branch. The index file is initialized with a list of all paths and, for each\npath, a blob object and a set of attributes. The blob object represents\nthe contents of the file as of the head of the current branch. The\nattributes (last modified time, size, etc.) are taken from the\ncorresponding file in the working tree. Subsequent changes to the\nworking tree can be found by comparing these attributes. The index may\nbe updated with new content, and new commits may be created from the\ncontent stored in the index. The index is also capable of storing multiple entries (called \"stages\")\nfor a given pathname. These stages are used to hold the various\nunmerged version of a file when a merge is in progress." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-svn - Bidirectional operation between a Subversion repository and Git propget" }, { "role": "assistant", "content": "Gets the Subversion property given as the first argument, for a\nfile. A specific revision can be specified with -r/--revision." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "What is the CouchDB replication protocol? Is it like Git?\nIs there technical documentation describing how replication between two Couches works?\nWhat is the basic overview of CouchDB replication? What are some noteworthy characteristics about it?" }, { "role": "assistant", "content": "Unfortunately there is no detailed documentation describing the replication protocol. There is only the reference implementation built into CouchDB, and Filipe Manana's rewrite of the same which will probably become the new implmentation in the future.\nHowever, this is the general idea:\nKey points\nIf you know Git, then you know how Couch replication works. Replicating is very similar to pushing or pulling with distributed source managers like Git.\nCouchDB replication does not have its own protocol. A replicator simply connects to two DBs as a client, then reads from one and writes to the other. Push replication is reading the local data and updating the remote DB; pull replication is vice versa.\n\nFun fact 1: The replicator is actually an independent Erlang application, in its own process. It connects to both couches, then reads records from one and writes them to the other.\nFun fact 2: CouchDB has no way of knowing who is a normal client and who is a replicator (let alone whether the replication is push or pull). It all looks like client connections. Some of them read records. Some of them write records.\n\nEverything flows from the data model\nThe replication algorithm is trivial, uninteresting. A trained monkey could design it. It's simple because the cleverness is the data model, which has these useful characteristics:\n\nEvery record in CouchDB is completely independent of all others. That sucks if you want to do a JOIN or a transaction, but it's awesome if you want to write a replicator. Just figure out how to replicate one record, and then repeat that for each record.\nLike Git, records have a linked-list revision history. A record's revision ID is the checksum of its own data. Subsequent revision IDs are checksums of: the new data, plus the revision ID of the previous.\nIn addition to application data ({\"name\": \"Jason\", \"awesome\": true}), every record stores the evolutionary timeline of all previous revision IDs leading up to itself.\n\nExercise: Take a moment of quiet reflection. Consider any two different records, A and B. If A's revision ID appears in B's timeline, then B definitely evolved from A. Now consider Git's fast-forward merges. Do you hear that? That is the sound of your mind being blown.\n\nGit isn't really a linear list. It has forks, when one parent has multiple children. CouchDB has that too.\n\nExercise: Compare two different records, A and B. A's revision ID does not appear in B's timeline; however, one revision ID, C, is in both A's and B's timeline. Thus A didn't evolve from B. B didn't evolve from A. But rather, A and B have a common ancestor C. In Git, that is a \"fork.\" In CouchDB, it's a \"conflict.\"\nIn Git, if both children go on to develop their timelines independently, that's cool. Forks totally support that.\nIn CouchDB, if both children go on to develop their timelines independently, that cool too. Conflicts totally support that.\nFun fact 3: CouchDB \"conflicts\" do not correspond to Git \"conflicts.\" A Couch conflict is a divergent revision history, what Git calls a \"fork.\" For this reason the CouchDB community pronounces \"conflict\" with a silent n: \"co-flicked.\"\n\nGit also has merges, when one child has multiple parents. CouchDB sort of has that too.\n\nIn the data model, there is no merge. The client simply marks one timeline as deleted and continues to work with the only extant timeline.\nIn the application, it feels like a merge. Typically, the client merges the data from each timeline in an application-specific way. Then it writes the new data to the timeline. In Git, this is like copying and pasting the changes from branch A into branch B, then commiting to branch B and deleting branch A. The data was merged, but there was no git merge.\nThese behaviors are different because, in Git, the timeline itself is important; but in CouchDB, the data is important and the timeline is incidental—it's just there to support replication. That is one reason why CouchDB's built-in revisioning is inappropriate for storing revision data like a wiki page.\n\n\nFinal notes\nAt least one sentence in this writeup (possibly this one) is complete BS." } ]
[ { "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 PORCELAIN FORMAT In this format, each line is output after a header; the\nheader at the minimum has the first line which has: 40-byte SHA-1 of the commit the line is attributed to; the line number of the line in the original file; the line number of the line in the final file; on a line that starts a group of lines from a different\ncommit than the previous one, the number of lines in this\ngroup. On subsequent lines this field is absent. This header line is followed by the following information\nat least once for each commit: the author name (\"author\"), email (\"author-mail\"), time\n(\"author-time\"), and time zone (\"author-tz\"); similarly\nfor committer. the filename in the commit that the line is attributed to. the first line of the commit log message (\"summary\"). The contents of the actual line are output after the above\nheader, prefixed by a TAB. This is to allow adding more\nheader elements later. The porcelain format generally suppresses commit information that has\nalready been seen. For example, two lines that are blamed to the same\ncommit will both be shown, but the details for that commit will be shown\nonly once. This is more efficient, but may require more state be kept by\nthe reader. The --line-porcelain option can be used to output full\ncommit information for each line, allowing simpler (but less efficient)\nusage like: # count the number of lines attributed to each author\ngit blame --line-porcelain file |\nsed -n 's/^author //p' |\nsort | uniq -c | sort -rn" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_NAMESPACE" }, { "role": "assistant", "content": "Set the Git namespace; see gitnamespaces for details.\nThe --namespace command-line option also sets this value." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-for-each-ref - Output information on each ref signature:key" }, { "role": "assistant", "content": "The key of the GPG signature of a commit." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git equivalent of 'hg serve'?\nIs there some sort of addon you can use to have a git equivalent of the Mercurial \nhg serve\n\n('hg serve' starts a local web-server which allows you to browse the repository history/branches etc)" }, { "role": "assistant", "content": "For just browsing files and revisions git instaweb is the right solution.\nIn addition if you want to set-up an ad-hoc git server for sharing work (push/pull) with some colleagues (which hg serve also allows you to do), you can use:\ngit daemon --reuseaddr --base-path=. --export-all --verbose --enable=receive-pack\n\nYour colleagues will use it with something like:\ngit clone git://<ip-address>/.git project\n\nAddition 1:\nIf you want to be able to push to this server, you need to add the --enable=receive-pack option (Thanks to Dominik below).\nAddition 2:\nIt just happened to me so I add it to the answer :-), if you are using a Redhat-based Linux distribution (RHEL, CentOS, etc.) and have an error \"git: 'daemon' is not a git command.\", then you need to install a seperate package for it:\nsudo yum install git-daemon" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order --exclude=<glob-pattern>" }, { "role": "assistant", "content": "Do not include refs matching <glob-pattern> that the next --all , --branches , --tags , --remotes , or --glob would otherwise\nconsider. Repetitions of this option accumulate exclusion patterns\nup to the next --all , --branches , --tags , --remotes , or --glob option (other options or arguments do not clear\naccumulated patterns). The patterns given should not begin with refs/heads , refs/tags , or refs/remotes when applied to --branches , --tags , or --remotes ,\nrespectively, and they must begin with refs/ when applied to --glob or --all . If a trailing /* is intended, it must be given\nexplicitly." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Merge (with squash) all changes from another branch as a single commit\nIn Git, is there a way to merge all changes from one branch into another, but squash to a single commit at the same time? \nI often work on a new feature in a separate branch and will regularly commit/push - mainly for backup or to transfer what I'm working on to another machine. Mostly those commits say \"Feature xxx WIP\" or something redundant.\nOnce that work is finished and I want to merge WIP branch back into master, I'd like to discard all those intermediate commits, and just a have a single clean commit.\nIs there an easy way to do this? \nAlternatively, how about a command that squashes all commits on a branch since the point where it was branched?" }, { "role": "assistant", "content": "Another option is git merge --squash <feature branch> then finally do a git commit.\nFrom Git merge\n\n--squash\n--no-squash \nProduce the working tree and index state as if a real merge\n happened (except for the merge\n information), but do not actually make\n a commit or move the HEAD, nor record\n $GIT_DIR/MERGE_HEAD to cause the next\n git commit command to create a merge\n commit. This allows you to create a\n single commit on top of the current\n branch whose effect is the same as\n merging another branch (or more in\n case of an octopus)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitLab CI/CD - Change Working Directory\n\nI am trying to implement a CI/CD pipeline for Terraform, however I need to change the pwd before running any further commands. \nIt appears the Terraform container only accepts Terraform commands, so cd/ls/echo $PATH are unrecognised. Do I need build an image which supports this and use that, or can I use the maintained Terraform images?\nI tried changing the ENTRYPOINT but appears only a minimal install is available due to the Alpine image." }, { "role": "assistant", "content": "You can change the entrypoint to /usr/bin/env in order to run a cd command. Example with gitlab-ci:\nvalidate_terraform:\n image:\n name: hashicorp/terraform:light\n entrypoint: [\"/usr/bin/env\"]\n stage: test\n\n script:\n - cd infrastructure/\n - terraform init\n - terraform validate" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "ImagePullBackOff error Google Kubernetes Engine\n\nI know a lot of people already had similar question, i read a few of them, but found nothing what actualy helped me so far.\nI have a gitlab with private repo enabled, I also use Google Kubernetes Engine. I have a few Docker container in my private repo, and I want to deploy one of them to the Kubernetes Engine.\nI have created a secret with kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt\nI also tried kubectl create secret docker-registry name --docker-server=registry.xy.z --docker-username=google --docker-password=xyz [email protected]\nThen I created my Deployment file:\napiVersion: extensions/v1beta1\nkind: Deployment\nmetadata:\nname: backend-test\nlabels:\napp: 13371337\nspec:\nreplicas: 1\ntemplate:\nmetadata:\nlabels:\napp: 13371337\nspec:\n containers:\n - name: backend\n image: registry.xy.z/group/project/backend:latest\n imagePullPolicy: Always\n ports:\n - containerPort: 8080\n imagePullSecrets:\n - name: db-user-pass or name\n\nAny ideas how to get it running?" }, { "role": "assistant", "content": "Using kubectl create secret docker-registry name is a right way to provide credentials of private docker registry.\nimagePullSecrets options looking good too, if you specify there a name of your docker-registry secret.\nSo, from Kubernetes path everything looking good.\nTry to check events of the pod which will be created by Deployment, just find you pod by kubectl get pods and call kubectl describe pod $name_of_your_pod, you will see an actual reason why it cannot pull an image.\nAlso, if your depository is insecure or has self-signed certificate, try to follow that guide to allow docker daemon pulling image from there, that is an often reason of image pull failures." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-stripspace" }, { "role": "assistant", "content": "Remove unnecessary whitespace" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-grep - Print lines matching a pattern --all-match" }, { "role": "assistant", "content": "When giving multiple pattern expressions combined with --or ,\nthis flag is specified to limit the match to files that\nhave lines to match all of them." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip rebase.forkPoint" }, { "role": "assistant", "content": "If set to false set --no-fork-point option by default." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Gitlab / Redmine automatic close issue with commit\n\nWe are using Gitlab (7.10.2) and Redmine (3.0.2).\nAll issues are managed in Redmine and Gitlab manages all git-repositories.\nWe set up Gitlab via the UI so far that commits with the message 'Close #234' are clickable and pointing to the corresponding Redmine ticket website.\nWe now want to achieve that tickets in Redmine are directly linked with Gitlab commits.\nIf we are using the internal Gitlab issue system and set the commit-message to ‘Close #234’ the ticket 234 is automatic closed and linked with the commit.\nBut with Redmine as issue service system we are not able to automatic close issues with commits or have any information about this in Redmine.\nDoes anyone knows how we can modify Gitlab and/or Redmine to close Redmine tickets with Gitlab commits?" }, { "role": "assistant", "content": "You can use Redmine as an issue tracker with setting the redmine service in Gitlab (In your project -> Services -> Redmine -> fill the URLs, and set active). If this works, when you press \"new issue\" button in Gitlab, you are redirected to Redmine new issue page. In Gitlab you should have WebHook to inform the Redmine about new push into the repo. This can be set in the settings \"In your project -> Settings -> Web hooks\" (how, see here).\nIn Redmine go to Administration -> Settings -> Repositories. Check your referencing keywords. \"closes\" or \"close\" should be in the list. Finally in the same tab there is the table at the bottom, where you choose tracker, your fixing keyword (closes, close), set applied status to \"Closed\", and choose the appropriate amount of % Done (100%). \nSimilarly you can set other keywords to change status in Redmine tickets.\nUse the redmine_gitlab_hook to keep Redmine repo up-to date." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I add a group reviewer in Gitlab?\n\nI periodically need to add more than 10 people to MR and I do it manually. I add only one person at a time, through the search. Can I somehow add the whole team to the reviewers?" }, { "role": "assistant", "content": "This does not seem to be supported, and could be added as a feature request, to be referenced in Epic: Merge request reviewers.\nThe alternative is to use quick actions, with GitLab 13.7+ (issue 241244)\n\nBut that presupposes you know the users' names beforehand." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-credential" }, { "role": "assistant", "content": "Retrieve and store user credentials" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to replace master branch in Git, entirely, from another branch? [duplicate]\nThis question already has answers here:\n \n \n\n\n\n\nMake the current Git branch a master branch\n\n (17 answers)\n \n\nClosed 4 years ago.\n\n\n\nI have two branches in my Git repository:\n\nmaster\nseotweaks (created originally from master)\n\nI created seotweaks with the intention of quickly merging it back into master. However, that was three months ago and the code in this branch is 13 versions ahead of master.\nIt has effectively become our working master branch as all the code in master is more or less obsolete now.\nVery bad practice I know, lesson learned.\nDo you know how I can replace all of the contents of the master branch with those in seotweaks?\nI could just delete everything in master and merge, but this does not feel like best practice." }, { "role": "assistant", "content": "You should be able to use the “ours” merge strategy to overwrite master with seotweaks like this:\ngit checkout master\ngit pull\ngit checkout seotweaks\ngit merge -s ours master\ngit checkout master\ngit merge seotweaks\n\nThe first two steps are a useful precaution to ensure your local copy of master is up-to-date. The result should be that your master is now essentially seotweaks.\n(-s ours is short for --strategy=ours)\nFrom the docs about the 'ours' strategy:\n\nThis resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches. Note that this is different from the -Xours option to the recursive merge strategy.\n\nUpdate from comments: If you get fatal: refusing to merge unrelated histories, then change the second line to this: git merge --allow-unrelated-histories -s ours master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rebase - Reapply commits on top of another base tip --rerere-autoupdate --no-rerere-autoupdate" }, { "role": "assistant", "content": "After the rerere mechanism reuses a recorded resolution on\nthe current conflict to update the files in the working\ntree, allow it to also update the index with the result of\nresolution. --no-rerere-autoupdate is a good way to\ndouble-check what rerere did and catch potential\nmismerges, before committing the result to the index with a\nseparate git add ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "force git to accept cherry-pick's changes\nI did cherry-pick from a gerrit review in my branch.\nIn gerrit code review, I have two patch sets and I cherry-picked patch one before, so now I want to do the second patch set, but there are conflicts, how can I force git to accept all changes?\nThanks!" }, { "role": "assistant", "content": "You can tell it to always prefer the changes of the commit you are cherry-picking:\ngit cherry-pick commitish --strategy-option theirs\n\ncommitish can be a SHA-1 hash of a commit, or a branch-name for the lastest commit of that branch, branch-name~1 for the commit before that etc.\nIf you want to do the reverse, use:\ngit cherry-pick commitish --strategy-option ours\n\nThe shorthand for --strategy-option is -X (uppercased X).\nPS: What is the commit-ish, tree-ish?" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Android Studio can't login to GitHub\n\nI'm getting this issue while logging in on GitHub on Android Studio: \n\nCan't login: Can't get user info 404: Not found\n\n\nHas someone faced this issue? How can I get around this?" }, { "role": "assistant", "content": "I have faced this problem too. Try using token to login.\nLog in to github.com on the browser. Go to Settings -> Developer settings -> Personal access tokens. There you can create a new token and then, go back to Android Studio, select Enter Token at the login prompt." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options receive.unpackLimit" }, { "role": "assistant", "content": "If the number of objects received in a push is below this\nlimit then the objects will be unpacked into loose object\nfiles. However if the number of received objects equals or\nexceeds this limit then the received pack will be stored as\na pack, after adding any missing delta bases. Storing the\npack from a push can make the push operation complete faster,\nespecially on slow filesystems. If not set, the value of transfer.unpackLimit is used instead." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options core.useReplaceRefs" }, { "role": "assistant", "content": "If set to false , behave as if the --no-replace-objects option was given on the command line. See git and git-replace for more information." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker <blob>" }, { "role": "assistant", "content": "Indicates a blob object name." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "There is no tracking information for the current branch\nI've been using github from a relatively short period, and I've always used the client to perform commits and pulls. I decided to try it from the git bash yesterday, and I successfully created a new repo and committed files.\nToday I did changes to the repository from another computer, I've committed the changes and now I'm back home and performed a git pull to update my local version and I get this:\nThere is no tracking information for the current branch.\n Please specify which branch you want to merge with.\n See git-pull(1) for details\n\n git pull <remote> <branch>\n\nIf you wish to set tracking information for this branch you can do so with:\n\n git branch --set-upstream develop origin/<branch>\n\nthe only contributor to this repo is me and there are no branches (just a master). I'm on windows and I've performed the pull from git bash:\n\ngit status:\n$ git status\n# On branch master\nnothing to commit, working directory clean\n\ngit branch:\n$ git branch\n* master\n\nWhat am I doing wrong?" }, { "role": "assistant", "content": "You could specify what branch you want to pull:\ngit pull origin master\n\nOr you could set it up so that your local master branch tracks github master branch as an upstream:\ngit branch --set-upstream-to=origin/master master\ngit pull\n\nThis branch tracking is set up for you automatically when you clone a repository (for the default branch only), but if you add a remote to an existing repository you have to set up the tracking yourself. Thankfully, the advice given by git makes that pretty easy to remember how to do." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I get bash completion to work with aliases?\nCase in point: \nI'm a on mac with bash v3.2.17, I'm using git installed via macports with the bash_completion variant.\nWhen I type git checkout m<tab>. for example, I get it completed to master.\nHowever, I've got an alias to git checkout, gco. When I type gco m<tab>, I don't get the branch name autocompleted.\nIdeally I'd like autocompletion to just magically work for all my aliases. Is it possible? Failing that, I'd like to manually customize it for each alias. So, how do I go about either?" }, { "role": "assistant", "content": "As stated in the comments above,\ncomplete -o default -o nospace -F _git_checkout gco\n\nwill no longer work. However, there's a __git_complete function in git-completion.bash which can be used to set up completion for aliases like so:\n__git_complete gco _git_checkout" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options gc.cruftPacks" }, { "role": "assistant", "content": "Store unreachable objects in a cruft pack (see git-repack ) instead of as loose objects. The default\nis true ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs" }, { "role": "assistant", "content": "Combined diff format Any diff-generating command can take the -c or --cc option to\nproduce a combined diff when showing a merge. This is the default\nformat when showing merges with git-diff or git-show . Note also that you can give suitable --diff-merges option to any of these commands to force generation of\ndiffs in a specific format. A \"combined diff\" format looks like this: diff --combined describe.c\nindex fabadb8,cc95eb0..4866510\n--- a/describe.c\n+++ b/describe.c\n@@@ -98,20 -98,12 +98,20 @@@\n\treturn (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;\n }\n\n- static void describe(char *arg)\n -static void describe(struct commit *cmit, int last_one)\n++static void describe(char *arg, int last_one)\n {\n +\tunsigned char sha1[20];\n +\tstruct commit *cmit;\n\tstruct commit_list *list;\n\tstatic int initialized = 0;\n\tstruct commit_name *n;\n\n +\tif (get_sha1(arg, sha1) < 0)\n +\t\tusage(describe_usage);\n +\tcmit = lookup_commit_reference(sha1);\n +\tif (!cmit)\n +\t\tusage(describe_usage);\n +\n\tif (!initialized) {\n\t\tinitialized = 1;\n\t\tfor_each_ref(get_name); It is preceded by a \"git diff\" header, that looks like\nthis (when the -c option is used): diff --combined file or like this (when the --cc option is used): diff --cc file It is followed by one or more extended header lines\n(this example shows a merge with two parents): index <hash>,<hash>..<hash>\nmode <mode>,<mode>..<mode>\nnew file mode <mode>\ndeleted file mode <mode>,<mode> The mode <mode>,<mode>..<mode> line appears only if at least one of\nthe <mode> is different from the rest. Extended headers with\ninformation about detected content movement (renames and\ncopying detection) are designed to work with the diff of two\n<tree-ish> and are not used by combined diff format. It is followed by a two-line from-file/to-file header: --- a/file\n+++ b/file Similar to the two-line header for the traditional unified diff\nformat, /dev/null is used to signal created or deleted\nfiles. However, if the --combined-all-paths option is provided, instead of a\ntwo-line from-file/to-file, you get an N+1 line from-file/to-file header,\nwhere N is the number of parents in the merge commit: --- a/file\n--- a/file\n--- a/file\n+++ b/file This extended format can be useful if rename or copy detection is\nactive, to allow you to see the original name of the file in different\nparents. Chunk header format is modified to prevent people from\naccidentally feeding it to patch -p1 . Combined diff format\nwas created for review of merge commit changes, and was not\nmeant to be applied. The change is similar to the change in the\nextended index header: @@@ <from-file-range> <from-file-range> <to-file-range> @@@ There are (number of parents + 1) @ characters in the chunk\nheader for combined diff format. Unlike the traditional unified diff format, which shows two\nfiles A and B with a single column that has - (minus — appears in A but removed in B), + (plus — missing in A but\nadded to B), or \" \" (space — unchanged) prefix, this format\ncompares two or more files file1, file2,…​ with one file X, and\nshows how X differs from each of fileN. One column for each of\nfileN is prepended to the output line to note how X’s line is\ndifferent from it. A - character in the column N means that the line appears in\nfileN but it does not appear in the result. A + character\nin the column N means that the line appears in the result,\nand fileN does not have that line (in other words, the line was\nadded, from the point of view of that parent). In the above example output, the function signature was changed\nfrom both files (hence two - removals from both file1 and\nfile2, plus ++ to mean one line that was added does not appear\nin either file1 or file2). Also, eight other lines are the same\nfrom file1 but do not appear in file2 (hence prefixed with + ). When shown by git diff-tree -c , it compares the parents of a\nmerge commit with the merge result (i.e. file1..fileN are the\nparents). When shown by git diff-files -c , it compares the\ntwo unresolved merge parents with the working tree file\n(i.e. file1 is stage 2 aka \"our version\", file2 is stage 3 aka\n\"their version\")." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Add all removed files to a commit with git\nI have made a round of changes to a branch and have 10 modified files and 10 files I have deleted.\nIf I run git add . this will only add the modified files to my commit. I want to remove the deleted files from the remote repo as well as add my modified files.\nI can use git rm filename, but since I have so many files to remove I was wondering if there was a way to do an 'all'.\nI Googled and found git rm -r * but this doesn't seem to work.\nIs there a command that will allow me to do this?" }, { "role": "assistant", "content": "If you want to stage all your changed and deleted files and commit in one-line:\ngit commit -am \"changing and deleting files\"\n\nNote that this command won't add new files as Git is about tracking changes. It relies on you to tell it which files are important enough to track. \nIf you have some or you just want to stage the changes before you commit, you will have to add your files manually or use wildcard:\n\ngit add -A stages All (include new files, modified and deleted)\ngit add . stages new and modified, without deleted\ngit add -u stages modified and deleted, without new\n\nthen commit:\ngit commit -m \"...\"" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Can I submit a pull request from GitLab.com to GitHub?\n\nMost of our work occurs on GitLab.com (i.e. not a local GitLab installation). If the upstream repo resides on GitHub, is there a way to submit a pull request to upstream? (If forking the upstream repo in a particular way is part of solution, that's ok.)" }, { "role": "assistant", "content": "No. The correct workflow would be forking the upstream project on GitHub to your own namespace. Then use your fork as upstream in your GitLab repository not the origin of your fork.\nFrom your GitLab repository you are then pushing changes to your fork (upstream). Then on GitHub you can submit a pull request from your GitHub fork to the origin." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_REFLOG_ACTION" }, { "role": "assistant", "content": "When a ref is updated, reflog entries are created to keep\ntrack of the reason why the ref was updated (which is\ntypically the name of the high-level command that updated\nthe ref), in addition to the old and new values of the ref.\nA scripted Porcelain command can use set_reflog_action\nhelper function in git-sh-setup to set its name to this\nvariable when it is invoked as the top level command by the\nend user, to be recorded in the body of the reflog." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How can I see what branch another branch was forked from?\nMy git repository has three branches, devel, stable and customers/acme_patches. A long time ago, stable was forked from devel, and all the bugfixing takes place in stable. Every now and then, stable is merged back into devel. customers/acme_patches is a branch with a few customer-specific patches. The branch wasn't merged into either of devel and stable.\nA bit of ASCII art to illustrate the scenario:\n\n o---o---o customers/acme_patches?\n /\n o---o---1---o---o---o stable\n / \\ \\\no---o---o---2---o---o---o---o devel\n \\\n o---o---o customers/acme_patches?\n\nNow I wonder:\nWhat branch was customers/acme_patches forked from - devel or stable? I only know that it was forked off one of them in the past, but I don't know which. E.g. it might have been commit 1 or 2 in the above diagram.\nI've been playing around with git log --oneline --graph and gitk but since customers/acme_patches was forked a few hundred commits ago, it's hard to follow the lines being drawn.\nIs there maybe a quick command (a little script is fine, too) which can somehow follow the commits in customers/acme_patches backwards to find the first commit with two children (the fork point) and then determines whether that commit was done in stable or in devel?\nIn the best case, I could just execute something like (excuse the prompt, I'm on Windows):\nC:\\src> git fork-origin customers/acme_patches\nstable" }, { "role": "assistant", "content": "With git 1.9/2.0 (Q1 2014), you can use git merge-base --fork-point to ask for the best common ancestor according to Git. \nYou can see that new option:\n\ndetailed in \"How do I recover/resynchronise after someone pushes a rebase or a reset to a published branch?\".\nused in \"How do you deal with a public repository that has already been rebased?\".\n\n\nAnd since commit ad8261d from John Keeping (johnkeeping), git rebase can use that same new --fork-point option, which can come in handy should you need to rebase a branch like customers/acme_patches onto devel.\n(I am not saying this would make sense in your specific scenario)\n\nNote: Git 2.16 (Q1 2018) does clarify and enhance documentation for \"merge-base --fork-point\", as it was clear what it computed but not why/what for.\nSee commit 6d1700b (09 Nov 2017) by Junio C Hamano (gitster).\n(Merged by Junio C Hamano -- gitster -- in commit 022dd4a, 27 Nov 2017) \n\nmerge-base --fork-point doc: clarify the example and failure modes\nThe illustrated history used to explain the --fork-point mode\n named three keypoint commits B3, B2 and B1 from the oldest to the\n newest, which was hard to read.\n Relabel them to B0, B1, B2.\n Also illustrate the history after the rebase using the --fork-point facility was made.\nThe text already mentions use of reflog, but the description is not\n clear what benefit we are trying to gain by using reflog.\n Clarify that it is to find the commits that were known to be at the tip of\n the remote-tracking branch.\n This in turn necessitates users to know the ramifications of the underlying assumptions, namely, expiry of reflog entries will make it impossible to determine which commits were at the tip of the remote-tracking branches and we fail when in doubt (instead of giving a random and incorrect result without even\n warning).\n Another limitation is that it won't be useful if you did not fork from the tip of a remote-tracking branch but from in the middle.\n Describe them.\n\nSo the documentation now reads:\n\nAfter working on the topic branch created with git checkout -b\n topic origin/master, the history of remote-tracking branch\n origin/master may have been rewound and rebuilt, leading to a\n history of this shape:\n\n o---B2\n /\n---o---o---B1--o---o---o---B (origin/master)\n \\\n B0\n \\\n D0---D1---D (topic)\n\n\nwhere origin/master used to point at commits B0, B1, B2 and now it\n points at B, and your topic branch was started on top of it back\n when origin/master was at B0, and you built three commits, D0, D1,\n and D, on top of it.\n Imagine that you now want to rebase the work you did on the topic on top of the updated origin/master.\nIn such a case, git merge-base origin/master topic would return the\n parent of B0 in the above picture, but B0^..D is not the range of\n commits you would want to replay on top of B (it includes B0, which\n is not what you wrote; it is a commit the other side discarded when\n it moved its tip from B0 to B1).\ngit merge-base --fork-point origin/master topic is designed to help in such a case.\n It takes not only B but also B0, B1, and B2 (i.e. old tips of the remote-tracking branches your repository's reflog knows about) into account to see on which commit your topic branch was built and finds B0, allowing you to replay only the commits on your topic, excluding the commits the other side later\n discarded.\nHence\n\n$ fork_point=$(git merge-base --fork-point origin/master topic)\n\n\nwill find B0, and\n\n$ git rebase --onto origin/master $fork_point topic\n\n\nwill replay D0, D1 and D on top of B to create a new history of this\n shape:\n\n o---B2\n /\n---o---o---B1--o---o---o---B (origin/master)\n \\ \\\n B0 D0'--D1'--D' (topic - updated)\n \\\n D0---D1---D (topic - old)\n\n\nA caveat is that older reflog entries in your repository may be\n expired by git gc.\n If B0 no longer appears in the reflog of the remote-tracking branch origin/master, the --fork-point mode obviously cannot find it and fails, avoiding to give a random and useless result (such as the parent of B0, like the same command without the --fork-point option gives).\nAlso, the remote-tracking branch you use the --fork-point mode\n with must be the one your topic forked from its tip.\n If you forked from an older commit than the tip, this mode would not find the fork point (imagine in the above sample history B0 did not exist,\n origin/master started at B1, moved to B2 and then B, and you forked\n your topic at origin/master^ when origin/master was B1; the shape of\n the history would be the same as above, without B0, and the parent\n of B1 is what git merge-base origin/master topic correctly finds,\n but the --fork-point mode will not, because it is not one of the\n commits that used to be at the tip of origin/master)." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Authenticate Jenkins CI for Github private repository\n\nI'd like for Jenkins to automagically fetch data from my private repository hosted on Github.\nBut I have no idea how to accomplish that task.. Tried the documentation, generating ssh-key for jenkins user and all what I can see is: \"unable to clone the repo\". I've checked URLs - they are valid.\nAny clues, maybe you know some docs/blogs/whatever which are describing this kind of stuff?" }, { "role": "assistant", "content": "Perhaps GitHub's support for deploy keys is what you're looking for? To quote that page:\n\nWhen should I use a deploy key?\nSimple, when you have a server that needs pull access to a single private repo. This key is attached directly to the repository instead of to a personal user account.\n\nIf that's what you're already trying and it doesn't work, you might want to update your question with more details of the URLs being used, the names and location of the key files, etc.\n\nNow for the technical part: How to use your SSH key with Jenkins?\nIf you have, say, a jenkins unix user, you can store your deploy key in ~/.ssh/id_rsa. When Jenkins tries to clone the repo via ssh, it will try to use that key.\nIn some setups, you cannot run Jenkins as an own user account, and possibly also cannot use the default ssh key location ~/.ssh/id_rsa. In such cases, you can create a key in a different location, e.g. ~/.ssh/deploy_key, and configure ssh to use that with an entry in ~/.ssh/config:\nHost github-deploy-myproject\n HostName github.com\n User git\n IdentityFile ~/.ssh/deploy_key\n IdentitiesOnly yes\n\nBecause all you authenticate to all Github repositories using [email protected] and you don't want the above key to be used for all your connections to Github, we created a host alias github-deploy-myproject. Your clone URL now becomes\ngit clone github-deploy-myproject:myuser/myproject\n\nand that is also what you put as repository URL into Jenkins.\n(Note that you must not put ssh:// in front in order for this to work.)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --color-moved[=<mode>]" }, { "role": "assistant", "content": "Moved lines of code are colored differently.\nIt can be changed by the diff.colorMoved configuration setting.\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": "gitlab - Push to a repository using access_token\n\nI implemented the oauth2 web flow in order to get access_token from users of my app. With the access_token, I would like to do the following actions: \n\nGet user informations \nCreate a repo for this user \nPush code to this repo (using git push )\n\nI already successfully get the user information(1) and create a repo(2)\nThe problem is I can't push code (3), I got \"Unauthorized\" error. \nThe command I run:\ngit remote add origin https://gitlab-ci-token<mytoken>@gitlab.com/myuser/myrepo.git \ngit push origin master" }, { "role": "assistant", "content": "You should do\ngit remote add origin https://<access-token-name>:<access-token>@gitlab.com/myuser/myrepo.git\n\nNote that this stores the access token as plain text in the .git\\config file. To avoid this you can use the git credential system, providing the access token name for \"username\" and the access token for \"password\". This should store the credentials in the git credential system in a more secure way." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-send-email - Send a collection of patches as emails sendmail" }, { "role": "assistant", "content": "Quoted aliases and quoted addresses are not supported: lines that\ncontain a \" symbol are ignored. Redirection to a file ( /path/name ) or pipe ( |command ) is not\nsupported. File inclusion ( :include: /path/name ) is not supported. Warnings are printed on the standard error output for any\nexplicitly unsupported constructs, and any other lines that are not\nrecognized by the parser." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to debug Gitlab LDAP authentication?\n\nI am trying to configure LDAP authentication with gitlab. My configuration is someting like:\nldap:\n enabled: true\n host: 'ldap.example.com'\n base: 'ou=People,o=example.com'\n port: 636\n uid: 'uid'\n method: 'ssl' # \"ssl\" or \"plain\"\n bind_dn: 'cn=gitlab,ou=Apps,o=example.com'\n password: 'password'\n allow_username_or_email_login: true\n\nI tested it with the following :\nldapsearch -b \"ou=People,o=example.com\" -s sub -D \"cn=gitlab,ou=Apps,o=example.com\" -H ldaps://ldap.example.com:636 -w \"password\" -x \"([email protected])\"\n\nThe line above works, but when I try to log in using LDAP, I always got \"invalid credentials\".\nHow can I troubleshoot this and narrow down the root cause f this problem?\nEdit 26/09:\nHere are some things I found on production.log:\nStarted GET \"/users/sign_in\" for 127.0.0.1 at 2013-09-23 17:42:58 -0300\nProcessing by Devise::SessionsController#new as HTML\n Rendered devise/sessions/_new_ldap.html.haml (1.7ms)\n Rendered devise/sessions/_new_base.html.haml (1.8ms)\n Rendered devise/sessions/_oauth_providers.html.haml (0.0ms)\n Rendered devise/sessions/new.html.haml within layouts/devise (4.2ms)\n Rendered layouts/_head.html.haml (1.6ms)\n Rendered layouts/_flash.html.haml (0.1ms)\nCompleted 200 OK in 9ms (Views: 6.9ms | ActiveRecord: 0.0ms)\nStarted POST \"/users/auth/ldap/callback\" for 127.0.0.1 at 2013-09-23 17:43:00 -0300\nProcessing by OmniauthCallbacksController#failure as HTML\n Parameters: {\"utf8\"=>\"â\", \"authenticity_token\"=>\"AwqZsVHRqOeZr+GLWWeGM7MyOAdk7cFl8/rZgbVRU+8=\", \"username\"=>\"[email protected]\", \"password\"=>\"[FILTERED]\"}\nRedirected to http://example.com/users/sign_in\nCompleted 302 Found in 3ms (ActiveRecord: 0.0ms)\nStarted GET \"/users/sign_in\" for 127.0.0.1 at 2013-09-23 17:43:00 -0300\nProcessing by Devise::SessionsController#new as HTML\n Rendered devise/sessions/_new_base.html.haml (2.8ms)\n Rendered devise/sessions/_oauth_providers.html.haml (0.1ms)\n Rendered devise/sessions/new.html.haml within layouts/devise (3.7ms)\n Rendered layouts/_head.html.haml (1.7ms)\n Rendered layouts/_flash.html.haml (0.1ms)\nCompleted 200 OK in 9ms (Views: 6.6ms | ActiveRecord: 0.0ms)\nStarted GET \"/\" for 127.0.0.1 at 2013-09-23 18:50:08 -0300\nProcessing by DashboardController#show as HTML\nCompleted 401 Unauthorized in 1ms\n\nEdit: I finally got the answer: a configuration on devise was stripping everyting after the \"@\". I can't recall the exact name, but I can post as soon as I got access to the machine. I discovered this by adding logs to the ldap oauth login." }, { "role": "assistant", "content": "The OP kidbomb mentions:\n\nA configuration on devise was stripping everything after the \"@\".\n I discovered this by adding logs to the ldap oauth login.\n\n\nCheck if the LDAP server is also accessible through ldap (not ldaps://)\nldapsearch -b \"ou=People,o=example.com\" -s sub -D \"cn=gitlab,ou=Apps,o=example.com\" -H ldap://ldap.example.com:389 -w \"password\" -x \"([email protected])\"\n\nIf yes, try and modify the gitlab.yml setting file ldap.method from 'ssl' to \"plain\".\nThe goal is to validate if the certificate used for contacting the ldap server is the issue here or not.\nIf you can contact the server through ldap:// (no certificate), that gives you at least a workaround.\nIf not (you have to go through ldaps://), you need to study more in detail the certificate associated to the LDAP server.\nopenssl s_client -connect ldap.example.com:636 2>/dev/null < /dev/null\n\n(I am not using -CAFile or -CAPath here, assuming the CA are at their default place mentioned in /etc/ssl/openssl.cnf)\nIf you get at the end of the output of that command the message:\nerror:num=21:unable to verify the first certificate \n\nThat means you need to get the certificate from the issuer.\nSee \"How To Verify SSL Certificate From A Shell Prompt\"." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options pack.useBitmaps" }, { "role": "assistant", "content": "When true, git will use pack bitmaps (if available) when packing\nto stdout (e.g., during the server side of a fetch). Defaults to\ntrue. You should not generally need to turn this off unless\nyou are debugging pack bitmaps." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to version build artifacts using GitHub Actions?\n\nMy use case is I want to have a unique version number for artifacts per each build/run. With current tools like CircleCI, Travis, etc. there is a build number available which is basically a counter that always goes up. So, I can create version strings like 0.1.0-27. This counter is increased each time even for the same commit.\nHow can I do something similar with GitHub Actions? Github actions only offer GITHUB_SHA and GITHUB_REF." }, { "role": "assistant", "content": "GitHub Actions now has a unique number and ID for a run/build in the github context.\n\ngithub.run_id : A unique number for each workflow run within a repository. This number does not change if you re-run the workflow run.\ngithub.run_number : A unique number for each run of a particular workflow in a repository. This number begins at 1 for the workflow's first run, and increments with each new run. This number does not change if you re-run the workflow run.\ngithub.run_attempt : A unique number for each attempt of a particular workflow run in a repository. This number begins at 1 for the workflow run's first attempt, and increments with each re-run.\n\nref: https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context\nYou can reference them in workflows like this:\n- name: Output Run ID\n run: echo ${{ github.run_id }}\n- name: Output Run Number\n run: echo ${{ github.run_number }}\n- name: Output Run Attempt\n run: echo ${{ github.run_attempt }}" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to remove files that are listed in the .gitignore but still on the repository?\nI have some files in my repository that should be ignored, i added them to the .gitignore but, of course, they are not removed from my repository.\nSo my question is, is there a magic command or script using filter-branch that can rewrite my history and remove all these files easily? Or simply a command that will create a commit that will remove them ?" }, { "role": "assistant", "content": "You can remove them from the repository manually:\ngit rm --cached file1 file2 dir/file3\n\nOr, if you have a lot of files:\ngit rm --cached `git ls-files -i -c --exclude-from=.gitignore`\n\nBut this doesn't seem to work in Git Bash on Windows. It produces an error message. The following works better:\ngit ls-files -i -c --exclude-from=.gitignore | xargs git rm --cached \n\nIn PowerShell on Windows this works even better (handles spaces in path and filenames):\ngit ls-files -i -c --exclude-from=.gitignore | %{git rm --cached $_}\n\nRegarding rewriting the whole history without these files, I highly doubt there's an automatic way to do it.\nAnd we all know that rewriting the history is bad, don't we? :)" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Add subdirectory of remote repo with git-subtree\nIs there a way to add a subdirectory of a remote repository into a subdirectory of my repository with git-subtree?\nSuppose I have this main repository:\n/\n dir1\n dir2\n\nAnd this library repository:\n/\n libdir\n some-file\n some-file-to-be-ignored\n\nI want to import library/libdir into main/dir1 so that it looks like this:\n/\n dir1\n some-file\n dir2\n\nUsing git-subtree, I can specify to import into dir1 with the --prefix argument, but can I also specify to only take the contents of a specific directory in the subtree?\nThe reason for using git-subtree is that I can later synchronize the two repositories." }, { "role": "assistant", "content": "I've been experimenting with this, and found some partial solutions, though none are quite perfect.\nFor these examples, I'll consider merging the four files from contrib/completion/ of https://github.com/git/git.git into third_party/git_completion/ of the local repository.\n1. git diff | git apply\nThis is probably the best way I've found. I only tested one-way merging; I haven't tried sending changes back to the upstream repository.\n# Do this the first time:\n$ git remote add -f -t master --no-tags gitgit https://github.com/git/git.git\n# The next line is optional. Without it, the upstream commits get\n# squashed; with it they will be included in your local history.\n$ git merge -s ours --no-commit gitgit/master\n# The trailing slash is important here!\n$ git read-tree --prefix=third_party/git-completion/ -u gitgit/master:contrib/completion\n$ git commit\n\n# In future, you can merge in additional changes as follows:\n# The next line is optional. Without it, the upstream commits get\n# squashed; with it they will be included in your local history.\n$ git merge -s ours --no-commit gitgit/master\n# Replace the SHA1 below with the commit hash that you most recently\n# merged in using this technique (i.e. the most recent commit on\n# gitgit/master at the time).\n$ git diff --color=never 53e53c7c81ce2c7c4cd45f95bc095b274cb28b76:contrib/completion gitgit/master:contrib/completion | git apply -3 --directory=third_party/git-completion\n# Now fix any conflicts if you'd modified third_party/git-completion.\n$ git commit\n\nSince it's awkward having to remember the most recent commit SHA1 that you merged from the upstream repository, I've written this Bash function which does all the hard work for you (grabbing it from git log):\ngit-merge-subpath() {\n local SQUASH\n if [[ $1 == \"--squash\" ]]; then\n SQUASH=1\n shift\n fi\n if (( $# != 3 )); then\n local PARAMS=\"[--squash] SOURCE_COMMIT SOURCE_PREFIX DEST_PREFIX\"\n echo \"USAGE: ${FUNCNAME[0]} $PARAMS\"\n return 1\n fi\n\n # Friendly parameter names; strip any trailing slashes from prefixes.\n local SOURCE_COMMIT=\"$1\" SOURCE_PREFIX=\"${2%/}\" DEST_PREFIX=\"${3%/}\"\n\n local SOURCE_SHA1\n SOURCE_SHA1=$(git rev-parse --verify \"$SOURCE_COMMIT^{commit}\") || return 1\n\n local OLD_SHA1\n local GIT_ROOT=$(git rev-parse --show-toplevel)\n if [[ -n \"$(ls -A \"$GIT_ROOT/$DEST_PREFIX\" 2> /dev/null)\" ]]; then\n # OLD_SHA1 will remain empty if there is no match.\n local RE=\"^${FUNCNAME[0]}: [0-9a-f]{40} $SOURCE_PREFIX $DEST_PREFIX\\$\"\n OLD_SHA1=$(git log -1 --format=%b -E --grep=\"$RE\" \\\n | grep --color=never -E \"$RE\" | tail -1 | awk '{print $2}')\n fi\n\n local OLD_TREEISH\n if [[ -n $OLD_SHA1 ]]; then\n OLD_TREEISH=\"$OLD_SHA1:$SOURCE_PREFIX\"\n else\n # This is the first time git-merge-subpath is run, so diff against the\n # empty commit instead of the last commit created by git-merge-subpath.\n OLD_TREEISH=$(git hash-object -t tree /dev/null)\n fi &&\n\n if [[ -z $SQUASH ]]; then\n git merge -s ours --no-commit \"$SOURCE_COMMIT\"\n fi &&\n\n git diff --color=never \"$OLD_TREEISH\" \"$SOURCE_COMMIT:$SOURCE_PREFIX\" \\\n | git apply -3 --directory=\"$DEST_PREFIX\" || git mergetool\n\n if (( $? == 1 )); then\n echo \"Uh-oh! Try cleaning up with |git reset --merge|.\"\n else\n git commit -em \"Merge $SOURCE_COMMIT:$SOURCE_PREFIX/ to $DEST_PREFIX/\n\n# Feel free to edit the title and body above, but make sure to keep the\n# ${FUNCNAME[0]}: line below intact, so ${FUNCNAME[0]} can find it\n# again when grepping git log.\n${FUNCNAME[0]}: $SOURCE_SHA1 $SOURCE_PREFIX $DEST_PREFIX\"\n fi\n}\n\nUse it like this:\n# Do this the first time:\n$ git remote add -f -t master --no-tags gitgit https://github.com/git/git.git\n$ git-merge-subpath gitgit/master contrib/completion third_party/git-completion\n\n# In future, you can merge in additional changes as follows:\n$ git fetch gitgit\n$ git-merge-subpath gitgit/master contrib/completion third_party/git-completion\n# Now fix any conflicts if you'd modified third_party/git-completion.\n\n2. git read-tree\nIf you're never going to make local changes to the merged in files, i.e. you're happy to always overwrite the local subdirectory with the latest version from upstream, then a similar but simpler approach is to use git read-tree:\n# Do this the first time:\n$ git remote add -f -t master --no-tags gitgit https://github.com/git/git.git\n# The next line is optional. Without it, the upstream commits get\n# squashed; with it they will be included in your local history.\n$ git merge -s ours --no-commit gitgit/master\n$ git read-tree --prefix=third_party/git-completion/ -u gitgit/master:contrib/completion\n$ git commit\n\n# In future, you can *overwrite* with the latest changes as follows:\n# As above, the next line is optional (affects squashing).\n$ git merge -s ours --no-commit gitgit/master\n$ git rm -rf third_party/git-completion\n$ git read-tree --prefix=third_party/git-completion/ -u gitgit/master:contrib/completion\n$ git commit\n\nI found a blog post that claimed to be able to merge (without overwriting) using a similar technique, but it didn't work when I tried it.\n3. git subtree\nI did actually find a solution that uses git subtree, thanks to http://jrsmith3.github.io/merging-a-subdirectory-from-another-repo-via-git-subtree.html, but it's incredibly slow (each git subtree split command below takes me 9 minutes for a 28 MB repo with 39000 commits on a dual Xeon X5675, whereas the other solutions I found take less than a second).\nIf you can live with the slowness, it should be workable:\n# Do this the first time:\n$ git remote add -f -t master --no-tags gitgit https://github.com/git/git.git\n$ git checkout gitgit/master\n$ git subtree split -P contrib/completion -b temporary-split-branch\n$ git checkout master\n$ git subtree add --squash -P third_party/git-completion temporary-split-branch\n$ git branch -D temporary-split-branch\n\n# In future, you can merge in additional changes as follows:\n$ git checkout gitgit/master\n$ git subtree split -P contrib/completion -b temporary-split-branch\n$ git checkout master\n$ git subtree merge --squash -P third_party/git-completion temporary-split-branch\n# Now fix any conflicts if you'd modified third_party/git-completion.\n$ git branch -D temporary-split-branch\n\nNote that I pass in --squash to avoid polluting the local repository with lots of commits, but you can remove --squash if you'd prefer to preserve the commit history.\nIt's possible that subsequent splits can be made faster using --rejoin (see https://stackoverflow.com/a/16139361/691281) - I didn't test that.\n4. Whole repo git subtree\nThe OP clearly stated that they want to merge a subdirectory of an upstream repository into a subdirectory of the local repository. If however instead you want to merge an entire upstream repository into a subdirectory of your local repository, then there's a simpler, cleaner, and better supported alternative:\n# Do this the first time:\n$ git subtree add --squash --prefix=third_party/git https://github.com/git/git.git master\n\n# In future, you can merge in additional changes as follows:\n$ git subtree pull --squash --prefix=third_party/git https://github.com/git/git.git master\n\nOr if you prefer to avoid repeating the repository URL, then you can add it as a remote:\n# Do this the first time:\n$ git remote add -f -t master --no-tags gitgit https://github.com/git/git.git\n$ git subtree add --squash --prefix=third_party/git gitgit/master\n\n# In future, you can merge in additional changes as follows:\n$ git subtree pull --squash --prefix=third_party/git gitgit/master\n\n# And you can push changes back upstream as follows:\n$ git subtree push --prefix=third_party/git gitgit/master\n# Or possibly (not sure what the difference is):\n$ git subtree push --squash --prefix=third_party/git gitgit/master\n\nSee also:\n\nhttp://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/\nhttps://hpc.uni.lu/blog/2014/understanding-git-subtree/\nhttp://getlevelten.com/blog/tom-mccracken/smarter-drupal-projects-projects-management-git-subtree\n\n5. Whole repo git submodule\nA related technique is git submodules, but they come with annoying caveats (for example people who clone your repository won't clone the submodules unless they call git clone --recursive), so I didn't investigate whether they can support subpaths.\nEdit: git-subtrac (from the author of the earlier git-subtree) seems to solve some of the problems with git submodules. So this might be a good option for merging an entire upstream repository into a subdirectory, but it still doesn't appear to support including only a subdirectory of the upstream repository." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "error: cannot lock ref.. 'refs/tags' exists; cannot create 'refs/tags/\nI'm getting a strange \"cannot lock ref\" error when trying to pull changes from github. I've tried git gc, and looked around for similar errors but can't find a solution.\n> git pull\nerror: cannot lock ref 'refs/tags/v2.8': 'refs/tags' exists; cannot create 'refs/tags/v2.8'\nFrom github.com:k3it/qsorder\n ! [new tag] v2.8 -> v2.8 (unable to update local ref)\nerror: cannot lock ref 'refs/tags/v2.9': 'refs/tags' exists; cannot create 'refs/tags/v2.9'\n ! [new tag] v2.9 -> v2.9 (unable to update local ref)" }, { "role": "assistant", "content": "Your Git is complaining that a reference (rather than a directory) named refs/tags exists. It's not clear what would create that, but see if git rev-parse refs/tags produces a hash ID. If so, that reference needs to go away:\ngit update-ref -d refs/tags\n\nafter which git fetch should work.\nIf git rev-parse refs/tags fails (which it should—refs/tags itself should not be a valid name) then this is not the problem and it's not clear what the actual problem is." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-add - Add file contents to the index -v --verbose" }, { "role": "assistant", "content": "Be verbose." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs --relative[=<path>] --no-relative" }, { "role": "assistant", "content": "When run from a subdirectory of the project, it can be\ntold to exclude changes outside the directory and show\npathnames relative to it with this option. When you are\nnot in a subdirectory (e.g. in a bare repository), you\ncan name which subdirectory to make the output relative\nto by giving a <path> as an argument. --no-relative can be used to countermand both diff.relative config\noption and previous --relative ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-stash - Stash the changes in a dirty working directory away <stash>" }, { "role": "assistant", "content": "This option is only valid for apply , branch , drop , pop , show commands. A reference of the form stash@{<revision>} . When no <stash> is\ngiven, the latest stash is assumed (that is, stash@{0} )." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options format.from" }, { "role": "assistant", "content": "Provides the default value for the --from option to format-patch.\nAccepts a boolean value, or a name and email address. If false,\nformat-patch defaults to --no-from , using commit authors directly in\nthe \"From:\" field of patch mails. If true, format-patch defaults to --from , using your committer identity in the \"From:\" field of patch\nmails and including a \"From:\" field in the body of the patch mail if\ndifferent. If set to a non-boolean value, format-patch uses that\nvalue instead of your committer identity. Defaults to false." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker git-for-each-ref" }, { "role": "assistant", "content": "Output information on each ref" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "List files in local Git repo?\nI'm using SparkleShare, which uses Git to sync files between my laptop and my backup server.\nNow I want to be able to browse the files and dirs that I've uploaded to my server, but I do not know how.\nI understand that Git uses some sort of special file hierarchy and that I cannot just list my files, right?\nBut what would I have to do to list them and browse my files?" }, { "role": "assistant", "content": "This command:\ngit ls-tree --full-tree -r --name-only HEAD\n\nlists all of the already committed files being tracked by your git repo." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options core.bigFileThreshold" }, { "role": "assistant", "content": "The size of files considered \"big\", which as discussed below\nchanges the behavior of numerous git commands, as well as how\nsuch files are stored within the repository. The default is\n512 MiB. Common unit suffixes of k , m , or g are\nsupported. Files above the configured limit will be: Stored deflated in packfiles, without attempting delta compression. The default limit is primarily set with this use-case in mind. With it,\nmost projects will have their source code and other text files delta\ncompressed, but not larger binary media files. Storing large files without delta compression avoids excessive memory\nusage, at the slight expense of increased disk usage. Will be treated as if they were labeled \"binary\" (see gitattributes ). e.g. git-log and git-diff will not compute diffs for files above this limit. Will generally be streamed when written, which avoids excessive\nmemory usage, at the cost of some fixed overhead. Commands that make\nuse of this include git-archive , git-fast-import , git-index-pack , git-unpack-objects and git-fsck ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-log - Show commit logs Default mode" }, { "role": "assistant", "content": "Commits are included if they are not TREESAME to any parent\n(though this can be changed, see --sparse below). If the\ncommit was a merge, and it was TREESAME to one parent, follow\nonly that parent. (Even if there are several TREESAME\nparents, follow only one of them.) Otherwise, follow all\nparents. This results in: .-A---N---O\n\t / / /\n\tI---------D Note how the rule to only follow the TREESAME parent, if one is\navailable, removed B from consideration entirely. C was\nconsidered via N , but is TREESAME. Root commits are compared to an\nempty tree, so I is !TREESAME. Parent/child relations are only visible with --parents , but that does\nnot affect the commits selected in default mode, so we have shown the\nparent lines." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git - Difference Between 'assume-unchanged' and 'skip-worktree'\nI have local changes to a file that I don't want to commit to my repository. It is a configuration file for building the application on a server, but I want to build locally with different settings. Naturally, the file always shows up when I do 'git status' as something to be staged. I would like to hide this particular change and not commit it. I won't make any other changes to the file.\nTo clarify, using .gitignore is not what I want since that only prevents new files from being added. I want to ignore changes to a file already in the repository.\nAfter some digging around, I see 2 options: assume-unchanged and skip-worktree. A previous question here talks about them but doesn't really explain their differences.\nHow are the two commands different? Why would someone use one or the other?" }, { "role": "assistant", "content": "You want to use skip-worktree:\ngit update-index --skip-worktree <file_name>\n\nassume-unchanged is designed for cases where it is expensive to check whether a group of files have been modified; when you set the bit, git (of course) assumes the files corresponding to that portion of the index have not been modified in the working copy. So it avoids a mess of stat calls. This bit is lost whenever the file's entry in the index changes (so, when the file is changed upstream).\nskip-worktree is more than that: even where git knows that the file has been modified (or needs to be modified by a reset --hard or the like), it will pretend it has not been, using the version from the index instead. This persists until the index is discarded.\nThere is a good summary of the ramifications of this difference and the typical use cases here: http://fallengamer.livejournal.com/93321.html.\nFrom that article:\n\n--assume-unchanged assumes that a developer shouldn’t change a file. This flag is meant for improving performance for not-changing folders like SDKs.\n--skip-worktree is useful when you instruct git not to touch a specific file ever because developers should change it. For example, if the main repository upstream hosts some production-ready configuration files and you don’t want to accidentally commit changes to those files, --skip-worktree is exactly what you want." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "ORIG_HEAD, FETCH_HEAD, MERGE_HEAD etc\nThere's a lot of useful git references (what is the exact name for this?), e.g. HEAD, ORIG_HEAD, FETCH_HEAD, MERGE_HEAD, @{upstream} etc.\nIs there any reference for this? A complete list with explanations?" }, { "role": "assistant", "content": "git help revisions brings up http://git-scm.com/docs/gitrevisions, which describes all the the most common ways to reference commits:\n\nHEAD names the commit on which you based the changes in the working tree.\nFETCH_HEAD records the branch which you fetched from a remote repository with your last git fetch invocation.\nORIG_HEAD is created by commands that move your HEAD in a drastic way, to record the position of the HEAD before their operation, so that you can easily change the tip of the branch back to the state before you ran them.\nMERGE_HEAD records the commit(s) which you are merging into your branch when you run git merge.\nCHERRY_PICK_HEAD records the commit which you are cherry-picking when you run git cherry-pick.\n\nFrom the git source, you can also find out about BISECT_HEAD, REVERT_HEAD, REJECT_NON_FF_HEAD and several others that you will almost certainly never need.\nThat reference also explains suffixes (^N, ~N, @{...}), ranges (.. vs ...), and more." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker GIT_INDEX_FILE" }, { "role": "assistant", "content": "This environment variable specifies an alternate\nindex file. If not specified, the default of $GIT_DIR/index is used." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-diff - Show changes between commits, commit and working tree, etc --indent-heuristic" }, { "role": "assistant", "content": "Enable the heuristic that shifts diff hunk boundaries to make patches\neasier to read. This is the default." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How do I create a master branch in a bare Git repository?\ngit init --bare test-repo.git\ncd test-repo.git\n\n(Folder is created with git-ish files and folders inside)\ngit status\n\nfatal: This operation must be run in a work tree\n(Okay, so I can't use git status with a bare repo; makes sense I guess)\ngit branch\n\n(Nothing, it seems the bare repo doesn't contain any branches. Do I have to add them from a cloned repo?)\ncd ..\nmkdir test-clone\ncd test-clone\ngit clone ../test-repo.git\n\n(I get a warning about cloning an empty repository)\ncd test-repo\n\n(The prompt changes to indicate I am on the master branch)\ngit branch\n\n(Shows no results - eh?)\ngit branch master\n\nfatal: Not a valid object name: 'master'\nUm. So how do I create the master branch in my bare repo?" }, { "role": "assistant", "content": "A bare repository is pretty much something you only push to and fetch from. You cannot do much directly \"in it\": you cannot check stuff out, create references (branches, tags), run git status, etc.\nIf you want to create a new branch in a bare Git repository, you can push a branch from a clone to your bare repo:\n# initialize your bare repo\n$ git init --bare test-repo.git\n\n# clone it and cd to the clone's root directory\n$ git clone test-repo.git/ test-clone\nCloning into 'test-clone'...\nwarning: You appear to have cloned an empty repository.\ndone.\n$ cd test-clone\n\n# make an initial commit in the clone\n$ touch README.md\n$ git add . \n$ git commit -m \"add README\"\n[master (root-commit) 65aab0e] add README\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 README.md\n\n# push to origin (i.e. your bare repo)\n$ git push origin master\nCounting objects: 3, done.\nWriting objects: 100% (3/3), 219 bytes | 0 bytes/s, done.\nTotal 3 (delta 0), reused 0 (delta 0)\nTo /Users/jubobs/test-repo.git/\n * [new branch] master -> master" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-bundle - Move objects and refs by archive verify <file>" }, { "role": "assistant", "content": "Used to check that a bundle file is valid and will apply\ncleanly to the current repository. This includes checks on the\nbundle format itself as well as checking that the prerequisite\ncommits exist and are fully linked in the current repository.\nThen, git bundle prints a list of missing commits, if any.\nFinally, information about additional capabilities, such as \"object\nfilter\", is printed. See \"Capabilities\" in gitformat-bundle for more information. The exit code is zero for success, but will\nbe nonzero if the bundle file is invalid. If file is - , the\nbundle is read from stdin." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Coloured Git diff to HTML\nI enjoy using git diff --color-words to clearly see the words that have changed in a file:\n\nHowever I want to share that diff with someone without git or a colour terminal for that matter. So does anyone know of a tool or trick that can convert colour escaped terminal output into HTML?" }, { "role": "assistant", "content": "wget \"http://www.pixelbeat.org/scripts/ansi2html.sh\" -O /tmp/ansi2html.sh\nchmod +x /tmp/ansi2html.sh\ngit diff --color-words --no-index orig.txt edited.txt | \\\n/tmp/ansi2html.sh > 2beshared.html\n\nWhat I really needed was an ANSI to HTML converter. And I found a very decent one on http://www.pixelbeat.org/.\nNOTE: You might not see any coloration unless you include --color or --color-words, probably because piping causes git diff to exclude colors.\nNOTE 2: You may need to install gnu sed and awk, especially if you're on a Mac. Do so with brew install gnu-sed gawk. You may need to add them to your path manually, too, e.g. with ln -s /usr/local/Cellar/gnu-sed/4.2.2/bin/gsed /usr/local/bin/." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-rev-list - Lists commit objects in reverse chronological order %cn" }, { "role": "assistant", "content": "committer name" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options uploadpack.allowReachableSHA1InWant" }, { "role": "assistant", "content": "Allow upload-pack to accept a fetch request that asks for an\nobject that is reachable from any ref tip. However, note that\ncalculating object reachability is computationally expensive.\nDefaults to false . Even if this is false, a client may be able\nto steal objects via the techniques described in the \"SECURITY\"\nsection of the gitnamespaces man page; it’s best to\nkeep private data in a separate repository." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-restore - Restore working tree files --ignore-skip-worktree-bits" }, { "role": "assistant", "content": "In sparse checkout mode, the default is to only update entries\nmatched by <pathspec> and sparse patterns in\n$GIT_DIR/info/sparse-checkout. This option ignores the sparse\npatterns and unconditionally restores any files in <pathspec> ." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to migrate gitlab backups to new server which has latest gitlab version\n\nI am trying to migrate my gitlab backups for my old server to new server. my old server has gitlab (gitlab-6.5.1-0) and my new server has gitlab version (gitlab 6.6.5-omnibus). i taken backup from my old server using the following command \nbundle exec rake gitlab:backup:create RAILS_ENV=production\n\nand when i try to restore this backup in new server using this command\ngitlab-rake gitlab:backup:restore BACKUP=1395394855\n\nI am getting the following output\nUnpacking backup ... done\nGitLab version mismatch:\n Your current GitLab version (6.6.5) differs from the GitLab version in the backup!\n Please switch to the following version and try again:\n version: 6f6f1588ba5123f156ee3b0635a061745b71fcde\n\nI tried searching for solution . but in all documents its says The backup is already migrated to the previous version. but none of them describes how to migrate backups . Any solution regarding this is Appreciated !" }, { "role": "assistant", "content": "This error message is produced by lib/backup/manager.rb#L87-L92:\n settings = YAML.load_file(\"backup_information.yml\")\n ENV[\"VERSION\"] = \"#{settings[:db_version]}\" if settings[:db_version].to_i > 0\n\n # restoring mismatching backups can lead to unexpected problems\n if settings[:gitlab_version] != Gitlab::VERSION\n puts \"GitLab version mismatch:\".red\n\nIt seems to force an incremental backup, as described in this comment:\n\nI have faced the same issue when restoring the backup to a new server.\nbackup.rake checks GITLAB commit number at time of backup is taken and when you are restoring to the same branch name from latest check out.\nI have to:\n\ndelete 5-2-stable and \ncheck out again 5-2-stable with the same commit hash ( git checkout -b 5-2-stable COMMIT-HASH), \nran all tasks as installing a fresh 5-2-stable release with same config/gitlab.yml, config/database.yml. \nThen I have copied backup.tar file into default /home/git/gitlab/tmp/backups and ran restore rake task.\n\nIt worked without any problem. Then I have followed 5-2-stable to 5-3-stable upgrade and it went all well." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Git: Clone from a branch other than master\nI am trying to pull from a repository in Github. But I don't want to clone the master branch. I want to clone some other branch. When I try git clone <url>, I get the files from the master branch. What should I do?\nAlso, suppose the code is updated in the repository and I want to get the latest code, should I again use git clone ? Because the size of the project is huge. Also if I make changes to the project locally, and then I again use git clone, will the changes I made still be there? What if I don't want changes to be there?\nI am not even sure if git clone is the right command. git pull or git fetch?\nI am sorry, I am very new to git." }, { "role": "assistant", "content": "Try this:\ngit init\ngit fetch url-to-repo branchname:refs/remotes/origin/branchname\n\nEDIT\nA better solution:\ngit clone -b mybranch --single-branch git://sub.domain.com/repo.git" } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "How to work simultaneously on a few branches\nThis is a follow-up on this question on creating branches.\nIt strikes me as odd that I would still work on one repository because the files on my local machine will be a weird mix of different experiments.\nI would imagine the best-practice method is to duplicate the repository and work in different folders on my computer for each branch -- but I don't know how to set this up. I have my current repository at Documents/San/CompProj so what are the commands I'd use to create a new repository tied to a different branch on a different local folder?\nGit is fairly new to me so I'd love any corrections you can make on what I'm assuming/asking above." }, { "role": "assistant", "content": "As of Git 2.5, git-worktree directly supports this workflow. See VonC's answer to this question for details.\nMy answer below may suffice if you don't like git-worktree for whatever reason.\n\nGit is designed to allow you to work within a single folder on disk. This is a single repository that contains all the branches you care about.† You checkout whichever branch you want to work on at the time.\nWithin a Git repository, you can only have a single branch checked out at a time. If you check out a second branch, the files on disk are removed and replaced with those from the second branch.\nIf you have the following branches:\nBRANCH-A BRANCH-B\nalpha.txt alpha.txt\nbravo.txt\ncharlie.txt charlie.txt\n delta.txt\n\nWhen you're on branch-A and you checkout branch-B, then bravo.txt will be removed and delta.txt will be added to your working directory.\nHowever, git-checkout will not overwrite changes you've made to files unless you supply the -f argument. If you make a change to alpha.txt then try to switch to branch-B, you'll get a message warning you that your changes would be lost and aborts the checkout.\nThe exceptions are untracked files. If you have branch-A checked out and you create a new file called echo.txt, Git will not touch this file when you checkout branch-B. This way, you can decide that you want to commit echo.txt against branch-B without having to go through the hassle of (1) move the file outside the repo, (2) checkout the correct branch, and (3) move the file back into the repo.\n\nFootnote\n† Actually, Git doesn't force you to use a single working directory. If you want, nothing is stopping you from creating different paths on disk for each branch you want to work on.\n/home/me/project\n +-- branch-a/\n +-- branch-b/\n +-- ...\n\nEach of these paths is its own Git repository (each one has a .git folder inside), and you can push and pull commits between the repos.\ncd ~/project ## Go to my projects directory\ngit clone branch-a branch-b ## Create a new branch-b\n\ncd branch-b\n ... work work work ...\ngit commit -a -m \"Made some changes on branch-b\"\n\ngit pull origin ## Fetch and merge the changes from branch-a\ngit push origin ## Push my changes back to branch-a\n\nThis is how some people use Mercurial if they aren't using named branches: they clone the repository into a new directory on disk for each branch they want, then push and pull changesets between them." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "GitLab CI and MsBuild (with tests)\n\nI am in the process of migrating my svn repsitories to git with GitLab.\nNow I have seen that there is a continuous integration implementation with GitLab CI and just want to try it out.\nI already installed and configured a Runner but Gitlab complains that I don't have a .gitlab-ci.yml file.\nI already use TeamCity for continuous integration so I don't want to put too much effort into writing a build script.\nCan anybody tell me where I can find a basic example of a gitlab-ci.yml file that basically just builds my Solution and runs all tests (MSTests)?" }, { "role": "assistant", "content": "Apparently there is no simple msbuild example but this should get you started:\nvariables:\n Solution: MySolution.sln\n\nbefore_script:\n - \"echo off\"\n - 'call \"%VS120COMNTOOLS%\\vsvars32.bat\"'\n # output environment variables (usefull for debugging, propably not what you want to do if your ci server is public)\n - echo.\n - set\n - echo.\n\nstages:\n - build\n - test\n - deploy\n\nbuild:\n stage: build\n script:\n - echo building...\n - 'msbuild.exe \"%Solution%\"'\n except:\n - tags\n\ntest:\n stage: test\n script:\n - echo testing...\n - 'msbuild.exe \"%Solution%\"'\n - dir /s /b *.Tests.dll | findstr /r Tests\\\\*\\\\bin\\\\ > testcontainers.txt\n - 'for /f %%f in (testcontainers.txt) do mstest.exe /testcontainer:\"%%f\"'\n except:\n - tags\n\ndeploy:\n stage: deploy\n script:\n - echo deploying...\n - 'msbuild.exe \"%Solution%\" /t:publish'\n only:\n - production\n\nFiguring out which tests to run is a bit tricky. My convention is that every project has a folder tests in which the test projects are named after the schema MyProject.Core.Tests (for a project called MyProject.Core) \nJust as a first feedback towards gitlab-ci\nI like the simplicity and the source control integration. But I would like to be able to modify the script before execution (especially while changing the script) but I could imaging to rerun a specific commit and inject variables or change the script (I can do that with teamcity). Or even ignore a failed test and rerun the script again (I do that a lot with teamcity). I know gitlab-ci does not know anything about my tests I just have a command line that returns an error code." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git - the stupid content tracker --namespace=<path>" }, { "role": "assistant", "content": "Set the Git namespace. See gitnamespaces for more\ndetails. Equivalent to setting the GIT_NAMESPACE environment\nvariable." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-clone - Clone a repository into a new directory --sparse" }, { "role": "assistant", "content": "Employ a sparse-checkout, with only files in the toplevel\ndirectory initially being present. The git-sparse-checkout command can be used to grow the\nworking directory as needed." } ]
[ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "git-config - Get and set repository or global options core.sparseCheckout" }, { "role": "assistant", "content": "Enable \"sparse checkout\" feature. See git-sparse-checkout for more information." } ]