I am working with my friend on a project the code of which is on Git. If I need to pull the changes from my friend's machine, can I pull it from my username/password using the following command without any issue?
git pull https://[email protected]/abc/theproject.git
Using the command lineGo into the directory for your project. Add a connection to your friend's version of the github repository, if you haven't already. Pull his/her changes. Push them back to your github repository.
Open your terminal and navigate to your git repository. Change Git user name by running: git config --global user.name “Your Name” Change Git user email by running: git config --global user. email “[email protected]”
just need to run git fetch , which will retrieve all branches and updates, and after that, run git checkout <branch> which will create a local copy of the branch because all branches are already loaded in your system.
This command will help to pull from the repository as the different user:
git pull https://[email protected]/projectfolder/projectname.git master
It is a workaround, when you are using same machine that someone else used before you, and had saved credentials
Was looking for the solution of a similar problem. Thanks to the answer provided by Davlet and Cupcake I was able to solve my problem.
Posting this answer here since I think this is the intended question
So I guess generally the problem that people like me face is what to do when a repo is cloned by another user on a server and that user is no longer associated with the repo.
How to pull from the repo without using the credentials of the old user ?
You edit the .git/config file of your repo.
and change
url = https://<old-username>@github.com/abc/repo.git/
to
url = https://<new-username>@github.com/abc/repo.git/
After saving the changes, from now onwards git pull will pull data while using credentials of the new user.
I hope this helps anyone with a similar problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With