I have set git configs in ~/.gitconfig as
[user]
name = david_abc
email = davidz#abclabs.com
But when I push to a repository:
git push --set-upstream origin master
Username for 'https://bitbucket.org': david_abc
Password for 'https://david_abc#bitbucket.org':
My question is why it doesn't recognize the name and email in the .gitconfig file.
Git does not use user.name for HTTP authentication, it is just user name that will be written in commits made by that user.
See git-credentials documentation for different options how to configure git to remember usernames (and eventually passwords) for repos.
Related
On command line "git clone https://username:app-password#bitbucket.org/dir/repo.git", works, wherein app-password is an "alphanumeric string created by bitbucket"
But when using with Yocto Recipe SRC_URI = "git://username:app-password#bitbucket.org/workspace/repo.git;protocol=https;"
gives error: "fatal: could not read the password for 'https://username#bitbucket.org': No such device or address".
Please advise how to use bitbucket app-passwords in the Yocto recipe for pulling git repo over https method?
I just managed to solve this with:
SRC_URI = "git://git#bitbucket.org/myworkspace/myrepo.git;protocol=https;user=myusername:my-app-password;"
Note that the username should not be your email address but your Bitbucket username.
Hope it helps someone.
I have jenkins installed in EC2 instance. When i try to talk to bitbucket repo:
Failed to connect to repository : Error performing git command: git ls-remote -h
I'm seeing 1 problem on your git configuration, you don't have set any credentials there.
Try to set your user credentials (For bitbucket) on the Jenkins settings.
I tried applying the private key to jenkins credentials page and public key to bitbucket ssh settings page.
We tried a couple of jeknkins bitcucket plugins and and tried applying the following:
Add Credentials --> Username and password --> then the bitbucket username and password
Add Credentials --> Kind-->SSH Username and private key --> bitbucket username and passphrase as blank
Add Credentials-->Kind-->Bitbucket personal access token-->private key-->from the ssh -->username->>bitbucket -->passphrase as blank
I have a jenkins setup with a big amount of jobs.
I'd like change all the jobs that clone from git with credentials X to credentials Y (which I already created)
Any way to do that programmatically?
If you haven't got a git credential helper configured (check with git config credential.helper), set one up (e.g. git config credential.helper store).
Then you can store a credential programmatically with
printf "username=<your_username>\npassword=<your_password>\nprotocol=https\nhost=your.git.host.net\n\n" | git credential approve
I ended up just doing a sed command on all the xml files in /var/lib/jenkins/jobs and replace the credentials id with the new id.
not so elegant but worked like a charm
I have setup ssh profile on my Ubuntu Machine and it is working fine as well.
Today, my other friend created new branch and pushed the code and branch on heroku.
Now, the problem is that I can't able to pull new branch on my local.
Below are my commands:
u#u:~/workspace/abc$ git pull heroku upgrade:master
fatal: Couldn't find remote ref upgradeu#u:~/workspace/abc$ fatal: The
remote end hung up unexpectedly
And if I do git fetch it shows no response.
My git config is:
[color]
ui = true
[user]
name = user
email = user#gmail.com
[core]
autocrlf = input
[push]
default = simple
[http]
postBuffer = 157286400
my ssh profile:
Host heroku.work
IdentityFile ~/.ssh/id_rsa_abc
Hostname heroku.com
User user#gmail.com
IdentitiesOnly yes
My remote is:
[remote "heroku"]
url = git#heroku.work:abc.git
fetch = +refs/heads/*:refs/remotes/origin/*
You wouldn't normally pull another branch. You would switch to it
Run git pull heroku to update your local repository from the remote
Then use git branch to display the available branches
Lastly use something like git checkout update to switch to the branch.
I've changed my name on GitHub and try to push my application.
I tried to push after git add and git commit, but it didn't work.
I deleted my repository and now I try to create a new repository, but git doesn't know about my new name:
dartnyan#PC:~/Projects/sample_app$ git remote add origin
https://github.com/NyanTyrrell/sample_app.git
fatal: remote origin already exists.
dartnyan#PC:~/Projects/sample_app$ git push -u origin master
Username for 'https://github.com': NyanTyrrell
Password for 'https://NyanTyrrell#github.com':
remote: Repository not found.
fatal: repository 'https://github.com/newDartNyan/sample_app.git/' not found
How can I change the path from /newDartNyan/ (old name) to /NyanTyrrell/ (new name)?
Using the option set-url of the remote command as such.
git remote set-url origin https://github.com/NyanTyrrell/sample_app.git
This will change the remote URL to the value provided, in this case https://github.com/NyanTyrrell/sample_app.git.