SVN change username - authentication

I found a lot of examples on how to change the username for specific revisions and so on.
But what I need is this:
I did a checkout with the authentication credentials of a workmate and need to change it to my credentials for future commits.
I cannot just checkout with my credentials due to the many changes that have been done already...
Anyone familiar with this?

You can change the user with
Subversion 1.6 and earlier:
svn switch --relocate protocol://currentUser#server/path protocol://newUser#server/path
Subversion 1.7 and later:
svn relocate protocol://currentUser#server/path protocol://newUser#server/path
To find out what protocol://currentUser#server/path is, run
svn info
in your working copy.

The easiest way to do this is to simply use the --username option on your next checkout or commit. For example:
svn commit --username newUser
or
svn co --username newUser
It will then be cached and will be used as the default username for future commands.
See also:
In Subversion can I be a user other than my login name?

I’ve had the exact same problem and found the solution in Where does SVN client store user authentication data?:
cd to ~/.subversion/auth/.
Do fgrep -l <yourworkmatesusernameORtheserverurl> */*.
Delete the file found.
The next operation on the repository will ask you again for username/password information.
(For Windows, the steps are analogous; the auth directory is in %APPDATA%\Subversion\).
Note that this will only work for SVN access schemes where the user name is part of the server login so it’s no use for repositories accessed using file://.

The command, that can be executed:
svn up --username newUsername
Works perfectly ;)
P.S. Just a hint: "--username" option can be executed on any "svn" command, not just update.

Go to Tortoise SVN --> Settings --> Saved Data.
There is an option to clear Authentication Data, click on the clear button, and it will allow you to select which connection you wanted to clear userid/pwd for.
After you do this, any checkout or update activity, it will reprompt for the userid and password.

If your protocol is http and you are using Subversion 1.7, you can switch the user at anytime by simply using the global --username option on any command.
When Ingo's method didn't work for me, this was what I found that worked.

for Win10 you should remove this folder and close/open your IDE
C:\Users\User\AppData\Roaming\Subversion\auth
, also in my projects no ".subversion" folders, only ".svn"

Also, for those who happened to realize too late, that they committed with the wrong credentials, the solution (after the fact) is to change the svn author of that revision: see this question
Basically the syntax is:
svn propset --revprop -r (revision_number) svn:author (new username)

Based on Ingo Kegel's solution I created a "small" bash script to change the username in all subfolders. Remember to:
Change <NEW_USERNAME> to the new username.
Change <OLD_USERNAME> to the current username (if you currently have no username set, simply remove <OLD_USERNAME>#).
In the code below the svn command is only printed out (not executed). To have the svn command executed, simply remove the echo and whitespace in front of it (just above popd).
for d in */ ; \
do echo $d ; pushd $d ; \
url=$(svn info | grep "URL: svn") ; \
url=$(echo ${url#"URL: "}) ; \
newurl=$(echo $url | sed "s/svn+ssh:\/\/<OLD_USERNAME>#/svn+ssh:\/\/<NEW_USERNAME>#/") ; \
echo "Old url: "$url ; echo "New url: "$newurl ; \
echo svn relocate $url $newurl ; \
popd ; \
done
Hope you find it useful!

I believe you could create you own branch (using your own credential) from the same trunk as your workmate's branch, merge from your workmate's branch to your working copy and then merge from your branch. All future commit should be marked as coming from you.

You could ask your colleague to create a patch, which will collapse all the changes that have been made into a single file that you can apply to your own check out. This will update all of your files appropriately and then you can revert the changes on his side and check yours in.

Tortoise on windows specific:
I attempted the above solution to no available. In my use case, the credentials where stored in the windows Credential Manager under the Windows Credential section and TortoiseSVN refused to change them by running the --username command.
You can edit the credentials by expanding the url for your repo and clicking edit.

Related

AWS Code Build with Github - get changed files

Tangentially related to: AWS CodeBuild with GitHub - only for specific directory
I have a codebuild project and a github repo with many files in it. A user may update any of these files in the git repo. I want to pass the name of the altered file(s) into my buildspec.yaml somehow; IE my merge job logic, specified in the buildspec.yaml, needs to know what files changed to do a per-file operation.
I am not talking about filters; Ie "only trigger this if X,Y,Z changed". Becuase the filter is there for a large number of XYZ, but I need to know which file(s) changed in my buildspec. IE something like $CHANGED_FILE_LIST.
I don't see this here: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
Maybe we have to do something like this: how to find out list of all changed files in git for full jenkins build and not for a particular commit?
git diff --name-only $GIT_PREVIOUS_COMMIT $GIT_COMMIT
but one would think this meta info could be provided by codebuild
I don't know if there's a blessed CodeBuild way to do this, but assuming you have access to a GitHub token in the build, you can query the GitHub metadata endpoint to get the info you need. Something like
curl -H "Authorization: token ${yourtoken}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/OWNER/REPO/commits/${CODEBUILD_SOURCE_VERSION} | jq '.files[].filename'
will return a list of files in the commit.
See https://docs.github.com/en/rest/commits/commits#get-a-commit for more details.
git diff --name-status $CODEBUILD_WEBHOOK_BASE_REF should do the trick
You can use git diff --name-only $$CODEBUILD_RESOLVED_SOURCE_VERSION $$CODEBUILD_WEBHOOK_PREV_COMMIT
Where $CODEBUILD_WEBHOOK_PREV_COMMIT is the commit id of the previous commit. And $CODEBUILD_RESOLVED_SOURCE_VERSION is the commit id of the actual one.
Inside a build phase you can check the change with:
-
|
if [ "$(git diff --name-only $CODEBUILD_WEBHOOK_PREV_COMMIT $CODEBUILD_RESOLVED_SOURCE_VERSION | grep -e <filde_path>)" != "" ]; then
#your code;
fi

Is there a way of adding username and password into the bzr checkout command?

I'm trying to automate an install process using bash, the following Bazaar command are part of this:
bzr export /home/path bzr+https://adress
bzr checkout bzr+https://address/ /home/path
After running these commands manually I'm prompted for username and password.
Is there any way of adding username and password directly into the commands in order to avoid the prompting?
Checked the Bazaar documentation, but couldn't find a solution.
The standard format for HTTP URLs can be used to pass a username/password combination:
$ bzr checkout bzr+https://username:password#host/path /local/path
Another option would be to add your credentials to ~/.config/bazaar/authentication.conf. See this page for details: http://doc.bazaar.canonical.com/beta/en/user-reference/authentication-help.html

How to get GitKraken feature working - "Use local SSH agent"

In brief
What is the proper way to set SSH keys in GitKraken to work with different git github/bitbucket repos?
Full details
The feature is snapshot as below in GitKraken preference.
When I check Use local SSH agent, git pull/push/... commands stop working. Using git command from console works normally for me.
Currently I have to uncheck it, and select the ssh key I want to use which is quite tiring when working with multiple git repo providers.
My google search and search on our site result litle helpful, so I asked here.
Are you running gitkraken under linux? For me the problem was, that I had to export SSH_AUTH_SOCK for gitkraken to find the agent.
So I start gitkraken like this:
SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" /usr/share/gitkraken/gitkraken
It can be a rare case, but if it could help at least someone:
For me perosnally, having the same issue after installing gitkraken, it did help to restart the computer after installation. Everything worked then.

can't fetch the go language repository on Debian

I follow the installation guide at http://golang.org/doc/install.html,
at first everything goes well, but problem comes at the "fetch the repository" step,
the guide says "$ hg clone -u release https://go.googlecode.com/hg/ go"
I follow the command but system always say that's wrong
so I read the help and modified it into
"$ hg clone -U release ..repo url... go"
(I don't see a lowercase u option but there's a U instead which means noupdate)
but still goes wrong
so I modified it again
"$ hg clone -U r60 ..repo url... go"
(I think release actually means go release number?)
ok, now that works finally
but, when it's over
cd to the go directory,hey,why all the files are hidden?!
and different with the url directory, for ex there's no such a src directory
so what am I doing wrong, and sorry for my english is not good
thank you for your help
for as a new user I can't attach a image and can't have more than two links in one post, see the picture link below at the reply to Evan Shaw
and in the guide page they say that I need to install python-setuptools python-dev and build-essential, because in ubuntu/debian users' distribution's package repository, the will "most likely be old and broken", what that mean? Am I suppose to install the tool manually(but not a easy_install)?
for a new user I can't answer myself,I think jnml points out the best matched answer
I thought this question is answerd,
the problem is that repository in Ubuntu/Debian for is tool old,
if you just easy_install (apt-get install )
you got version 1.0.1 , that's not match for the command gave on the go installation guide,
so a simple way to work it out is(thanks jnml for pointing this out):
hg clone
cd go
hg update release
that's done.
but I still wonder how can I get the latest version of be installed on my Debian,but that's another question,
Thanks a lot to all of you who reply to me, thank you for your help!
hg -u (lower case) is definitely correct, check your version of mercurial.
$ hg help clone
...
options:
-U --noupdate the clone will include an empty working copy (only a repository)
-u --updaterev REV revision, tag or branch to check out
...
$

BASH script to handle "authentication realm"

I have multiple SVN repositories which I intend to synchronize with other SVN server each night using svnsync like this:
svnsync synchronize --source-username my_server_user_name --source-password ... --sync-username dest_server_user_name --sync-password ... svn://dest_svn_server/svn/[repository_name]
But it fails with "Authentication realm" error and asks to enter login-password - when I enter dest_server_user_name-password again - it succeeds.
Is there a way to do it automatically somehow?
Thank you.
I found two ways to fix it:
1. Run svnsync with --non-interactive flag
2. Set property store-plaintext-passwords to yes within file ~/.subversion/servers