git-config

Using gitconfig per branch

回眸只為那壹抹淺笑 提交于 2019-11-28 01:27:20
问题 Our company uses many customized opensource project. Whenever I contribute upstream branch I have change to use my personal email/name. Is there any way to have gitconfig per branch? For example what I want is [remote 'gerrit'] name = 'Personal Name' [branch 'origin'] name = 'Name in company' 回答1: You can use post-checkout hook for this. Run $ touch .git/hooks/post-checkout $ chmod a+x .git/hooks/post-checkout Add contents to post-checkout script (edit names and branches as neccessary) #!/bin

Add a git merge driver to the repository?

白昼怎懂夜的黑 提交于 2019-11-27 17:34:17
问题 I'm creating a merge driver. I have defined a .gitattributes file as follows: filename merge=mergeStrategy I have created the merge driver in $PROJECT/.git/config as follows: [merge "mergeStrategy"] name = My merge strategy driver = scripts/mergeScript.sh This works fine locally, but I would like to commit this merge driver to the git repository so that the merge strategy is in effect for everyone. Is there a way I can add this (or other Git configuration options) to the repository itself?

Best practices for cross platform git config?

[亡魂溺海] 提交于 2019-11-27 16:58:16
Context A number of my application user configuration files are kept in a git repository for easy sharing across multiple machines and multiple platforms. Amongst these configuration files is .gitconfig which contains the following settings for handling the carriage return linefeed characters [core] autocrlf = true safecrlf = false Problem These settings also gets applied on a GNU/Linux platform which causes obscure errors. Question What are some best practices for handling these platform specific differences in configuration files? Proposed solution I realize this problem could be solved by

git multiple user names for the different projects within the same system [duplicate]

孤者浪人 提交于 2019-11-27 16:43:21
This question already has an answer here: Can I specify multiple users for myself in .gitconfig? 20 answers I have a different git repository for my office and a different git repo for my hobby projects. When I do git config --global user.name the user name changes globally and this creates a confusion of committing to a repo with user name. Hence the question is how can i have the same username across all my hobby projects and the same username across the office projects. I use the same machine to work on both the places. Just use --local instead of --global . In fact, local is the default so

Configure a local branch for push to specific branch

荒凉一梦 提交于 2019-11-27 11:43:09
问题 Sorry if this question has been asked already. Am cloning from a repo named "git_lab" which has a branch named "test" When cloning i use "-b myname_test" to create a local branch named "myname_test" and local clone is named "myname_git_lab" When i do "git pull" it automatically fetches and merges changes from "test" to "myname_test", but for git push, i need to specify the repo and branch name. $>git remote show git_lab Local branch configured for 'git pull': myname_test merges with remote

Using Git on Windows, behind an HTTP proxy, without storing proxy password on disk

▼魔方 西西 提交于 2019-11-27 10:43:19
问题 I'm using Git on Windows, on a corporate network where I'm behind an HTTP proxy with Basic authentication. Outbound SSH doesn't work, so I have to use HTTPS through the proxy. I'm aware of how to use git config http.proxy to configure the settings as http://[username]:[password]@[proxy]:[port] . However, particularly as this is a shared machine, I'd rather not store my password in my .gitconfig . Additionally, changing my .gitconfig using the git config command leaves my password in my bash

“simple” vs “current” push.default in git for decentralized workflow

余生颓废 提交于 2019-11-27 09:22:27
问题 Functionally speaking, in a decentralized workflow, I don't see the difference between simple and current options for push.default config setting. current will push the current branch to an identically named branch on the specified remote. simple will effectively do the same thing as well for both the tracked and any untracked remotes for the current branch (it enforces identical branch names in both cases). Can someone explain any important differences between the two for decentralized

How to change my Git username in terminal?

自古美人都是妖i 提交于 2019-11-27 09:11:55
问题 I was pushing and pulling from git in Terminal then I changed my username on github.com. I went to push some changes and it couldn't push because it was still recognizing my old username.. How do I change/update my username on git in terminal? 回答1: You probably need to update the remote URL since github puts your username in it. You can take a look at the original URL by typing git config --get remote.origin.url Or just go to the repository page on Github and get the new URL. Then use git

git:// through proxy

半腔热情 提交于 2019-11-27 09:09:50
问题 I'm behind a firewall that is blocking port 9418 (git) and am trying to install some tools that are explicitly doing a checkout of git://github.com/... , so I can't switch to https for the checkout. So I'm wondering if it's possible to redirect all traffic to port 9418 through a proxy and if so how :) 回答1: Have a look at core.gitproxy setting in Git config. Quick googling revealed this script that may be useful (or may not — I did not try it): https://gist.github.com/49288 回答2: If you are

Is it possible to have different Git configuration for different projects?

若如初见. 提交于 2019-11-27 09:08:46
问题 .gitconfig is usually stored in the user.home directory. I use a different identity to work on projects for Company A and something else for Company B (primarily the name / email). How can I have two different Git configurations so that my check-ins don't go with the name / email? 回答1: The .git/config file in a particular clone of a repository is local to that clone. Any settings placed there will only affect actions for that particular project. (By default, git config modifies .git/config ,