I'm trying to connect using http for a second github account I've recently set up. When I pushed to https://github.com/usernameOf2ndGithubAccount/repo.git, I always got the following error:
remote: Permission to usernameOf2ndGithubAccount/repo.git denied to usernameOf1stGithubAccount
That means I've probably made the username of my 1st github account as the default somewhere. But I've looked through all my environment variables and bashrc but couldn't find it to be set anywhere. Can someone please point out how to fix this issue? Thanks!
P.S. I've tried connecting using ssh for my 2nd github account (by using a new pair of private/public key), and that works fine.
You can specify the username to use in the URL, e.g.:
https://usernameOf2ndGithubAccount#github.com/usernameOf2ndGithubAccount/repo.git
When you set-up git, it will ask for a username and email. This will we global for all your repositories.
You could see your name and email with (which could be different for each repository)
git config user.name
git config user.email
You could change it as follows (only for the current git repository)
git config user.name "myname"
git config user.email "my#email.com"
To see your/update global config, pass --global (after config), e.g.
git config --global user.email
When using TortioseGit, you could easily view and change with a GUI.
This is windows credential manager problem. Nothing to do with SSH or HTTPS. You need to add the second account to the manager. It only reads the github site not the direct https path.
Bash terminal git config --global credential.useHttpPath true
this will add the direct path not just the github site.
Related
I'm trying to push my files to my GitHub, but I'm getting the following error:
error: cannot run rpostback-askpass: No such file or directory
fatal: could not read Username for 'https://github.com': Device not configured
Details:
I'm using MAC
My git version: git version 2.32.1 (Apple Git-133)
I'm linking my project to GitHub with HTTP protocole
I ran git config --global user.name and user.mail in the terminal in Rstudio
I tried to use the solution of running git push -u origin main and when I type in my credentials, it gives me the error: "authentication failed". I never changed my password to GitHub, I checked it today to enter the website, it works.
I tried using ssh protocol instead but it seems to be giving me even more errors even though I created my ssh key and added it successfully to my GitHub. Specifically when I click on create new project and add the ssh link Rstudio says:
Cloning into 'data-science-hw'...
ssh_askpass: exec(rpostback-askpass): No such file or directory Host key verification failed.
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
I went through all the possible suggestions I could find on the internet but none of them worked. I also tried linking a token generated by git, but it work either.
I would be very happy if anybody has any idea what else I could try..
I am running Nexus 3.0.1-01, and am using it to host both Maven repositories and NPM registries. For NPM, I have a local mirror of npmjs.org, a local NPM registry and a group that combines the two...
I have been using this with npm internally, where I can use the npm-public group as my registry and this has been working fine. So, I can use Nexus to mirror npmjs.
The next step is to take locally written npm modules and publish them to npm-releases (on my Nexus instance) so that these modules can be shared amongst the delivery teams here. I've been able to build out a package, and npm pack seems to behave.
I have run npm adduser to provide my Nexus credentials to my npm environment. I am using the same username/password I use when I log into the Nexus web app, and my user is assigned the admin role (so I should have all permissions). I can see the credentials in my .npmrc file
My registry value is still the npm-public group which combined the mirror and my local registry. I have ensured that the package.json of the module I am attempting to deploy has a "publishConfig" section that points to the url of the local registry (not the public group)
However, despite all of that, calling "npm publish" results in a 401 error...
Looking at the npm-debug.log, I can see it's attempting to call the HTTP PUT call to push the assembled tgz file to the registry, and this is returning a 401 error
I have enabled debug logging on the shiro package in the server, but I only ever see a single message thinking it needs authentication
2016-09-13 08:56:28,590+1000 DEBUG [qtp1257823896-4030] *UNKNOWN org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter - Authentication required: sending 401 Authentication challenge response.
According to the documentation, I've done all I'm supposed to do (npm add user) but I am unable to successfully deploy an npm module to my local repository.
Are there additional options I need to use when calling npm publish? Are there additional settings I need to make to the hosted npm repository in my server that will allow me to publish to it? I pretty much created it using the default values. Have I missed a step that is preventing me from deploying to my hosted npm registry?
Any help would be greatly appreciated, as I am stuck at the moment.
As it turns out, I did not have the Npm Bearer Token Realm in my list of active realms. Once I moved it to Active, the publish completed successfully!
Additonally to #EdH's answer we discovered that the format of .npmrc has changed so base64 encoded _auth will not work anymore... and the token has to be created by logging into the repo.
old .npmrc
registry=https://host/repo
_auth=12afdjsljl123213
new .npmrc
//host/repo/:_authtoken=uuidOfToken
Additionally to #Daniel's answer, I discovered that when adding user credentials/logging into npm, you can't have a trailing slash on the registry url.
Bad:
npm adduser --registry=https://repo.localhost/repository/npm-internal/
Good:
npm adduser --registry=https://repo/repository/npm-internal
Also, if you're looking to automate the login (i.e. non-interactively), I used a good tool called npm-cli-login.
npm-cli-login -u admin -p admin123 -e nick#foo.bar -r https://repo/repository/npm-internal
I realize that this post is a couple years old now, but as of struggling with this issue for many hours, I finally found what worked for me that I've not seen in many other places. The problem was that I was not specifying the _authToken within the .npmrc file. Adding this as shown below resolved the issue and I was able to successfully run npm commands without a 401 error.
.npmrc
registry=https://test.repo.com/repository/npm-group/
//test.repo.com/repository/npm-group/:_authToken=NpmToken.${NPM_TOKEN}
Another reason why you might get such an error is that you might have enabled anonymous access to the server for the 'npm Bearer Token Realm'. After disabling anonymous access you must also remove .npmrc and re-add the registry and adduser.
I am in the process of installing Jenkins to push changes made to a Github repo to a "live" repo on my server.
I have installed Jenkins on my Ubuntu server and using its web interface I have installed the Github, Git and Github API plugins. I've also created a build task in Jenkins which runs some shell commands when Github detects that a push has been made to its repo.
The commands are running but I seem to be hitting a permissions issue. I get the following error in the Jenkins Console:
+ git pull origin master
error: cannot open .git/FETCH_HEAD: Permission denied
Build step 'Execute shell' marked build as failure
Finished: FAILURE
The parent directory for the site (and all its subdirectories) is owned by a user "james" who belongs to a group "sudo". Jenkins has its own user "jenkins" who I have since added to the group "sudo". As "jenkins" and "james" are both "sudo" members and the group has permission to write, I am unsure why this error would be occuring?
Adding a user to the group sudo does not make that user member of the same group as the one protecting the .git folder.
It just allows jenkins or james to be added to the sudoers, and executing commands (specified in said sudoers) as root.
You need to check which group is protecting .git, or if it is the root group, modify the jenkins script in order to sudo git pull origin master.
The OP James Howell confirms in the comments:
I ended up changing the group owner of the directory to "jenkins" of which the jenkins user is already a member.
I created a subdomain on meteor.com to try it out, but now I'm moving on to a new domain so want to remove the existing subdomain on Meteor. I didn't set any password to the subdomain. I'm really confused on how to remove it from meteor.com. I also deleted the local repository that I had from my machine. Please help.
You can do it through the command line like you did to deploy on meteor.com.
To delete a meteor.com deployment, just run the same command with the --delete flag:
# navigate to your Meteor project
cd /...
meteor deploy --delete
According to the command documentation:
The --delete flag permanently removes a deployed application, including
all of its stored data.
You can always get more information about a command by running meteor help followed by the command name:
meteor help deploy
Just wanted to make an addition to it for those following this thread.
meteor deploy <example.meteor.com> --delete (This is the proper command. Replace example with your subdomain)
You might want to login to your local repo before initialising the --delete command
meteor login --email 'email-id-used-to-login-at-meteor.com'
You'll be prompted to input email-id and password. Then you're logged in!
Hope this helps.
I tried to pull repository so that I can merge the changes made to my repository.
But while using the pull command it gives following error:
$ git pull https://github.com/ShrutiRuparel/depot.git master
error: Failed connect to github.com:8080;
No error while accessing https://github.com/ShrutiRuparel/depot.git/info/refs
fatal: HTTP request failed
I tried setting the http proxy but no change.
push command worked perfectly fine but error with pull command.
Any suggestions?
I had the same issue because I forgot to remove my proxy configuration on Git.
git config --global http.proxy
If it returns something you have to unset the value with the following command :
git config --global --unset http.proxy
There is a lot of way to set a proxy for git and maybe this is not the good one. You can also check your environment variable.
echo $http_proxy
After that, it should works
Why are you using https?
For private repo on GitHub, you would use (as shown here):
git clone https://username#github.com/username/project.git
But for a public repo, a simple:
git clone http://github.com/username/project.git
should be enough.